SAP Program/ABAP

abap source hide & decompress

유부사모 2018. 1. 26. 15:08

1은 SE38이거나 "RPY_PROGRAM_READ"함수를 사용하여 코드를 볼 수 있습니다.
모든 코드는 REPOSRC 테이블에 저장되고 압축 모드로 저장됩니다
. 소스 코드를 볼 수 없습니다.

2. 다음 코드 암호화 프로그램하지만 코드가 암호화되면,주의 표기되고 SAP의 소스 코드를 볼 수없는
기준 링크 https://archive.sap.com/discussions/thread/740272을

REPORT z_hide_abap
  NO STANDARD PAGE HEADING.
 
DATA: gt_code(72)  TYPE c OCCURS 0,
      gv_code      LIKE LINE OF gt_code,
      gt_code2(72) TYPE c OCCURS 0.
 
PARAMETERS: program LIKE sy-repid.
 
START-OF-SELECTION.
 
  READ REPORT program INTO gt_code.
 
  IF sy-subrc NE 0.
    MESSAGE e398(00) WITH 'Report' program 'not found.'.
*   ATTENTION:
*   READ REPORT on a hidden source code return SY-SUBRC=8 !!!
  ENDIF. "IF sy-subrc NE 0
 
  READ TABLE gt_code INDEX 1 INTO gv_code.
 
* append *special* 1st line to hide cource code
  APPEND '*@#@@[SAP]' TO gt_code2.
  LOOP AT gt_code INTO gv_code.
    APPEND gv_code TO gt_code2.
  ENDLOOP.
 
  INSERT REPORT program FROM gt_code2.

3. 코드 복원
참조 링크 https://www.daniel-berlin.de/devel/sap-dev/decompress-abap-source-code/

코드 다운로드 https://github.com/daberlin/sap-reposrc-decompressor를
vs2015으로 명령 프롬프트는, 예를 들어 decompress.exe, 소스 코드를 컴파일 생성
ztme11으로, 다음 코드는 암호화 코드를 사용

*&---------------------------------------------------------------------*
*& Report ZS_REPOSRC_DOWNLOAD
*&---------------------------------------------------------------------*
*& Purpose: Download compressed source code from table REPOSRC
*& Author : Daniel Berlin
*& Version: 1.0.1
*& License: CC BY 3.0 (http://creativecommons.org/licenses/by/3.0/)
*&---------------------------------------------------------------------*

REPORT zs_reposrc_download.

DATA: v_fnam TYPE rlgrap-filename,  " Local file name
     v_file TYPE string,           " Same, but as a string
     v_xstr TYPE xstring,          " Source (compressed)
     v_xlen TYPE i,                " Length of source
     t_xtab TYPE TABLE OF x255.    " Source plugged into a table

PARAMETERS: report TYPE progname DEFAULT sy-repid           "#EC *
                  MATCHCODE OBJECT progname OBLIGATORY.

START-OF-SELECTION.

 " -- Select local file name
 WHILE v_fnam IS INITIAL.
   v_fnam = report.

   CALL FUNCTION 'NAVIGATION_FILENAME_HELP'
     EXPORTING
       default_path      = v_fnam
       mode              = 'S'
     IMPORTING
       selected_filename = v_fnam.
 ENDWHILE.

 v_file = v_fnam.

 " -- Fetch compressed source code
 SELECT SINGLE data INTO v_xstr FROM reposrc
         WHERE progname = report AND r3state = 'A'.

 v_xlen = XSTRLEN( v_xstr ).

 " -- Plug source into a table
 CALL METHOD cl_swf_utl_convert_xstring=>xstring_to_table
   EXPORTING
     i_stream = v_xstr
   IMPORTING
     e_table  = t_xtab
   EXCEPTIONS
     OTHERS   = 1.

 " -- Download to local file
 CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
     filetype     = 'BIN'
     filename     = v_file
     bin_filesize = v_xlen
   TABLES
     data_tab     = t_xtab
   EXCEPTIONS
     OTHERS       = 0.

다운로드 한 프로그램이 ztme11이면 ztme11을 decompress.exe가있는 디렉토리로 이동하십시오.
cmd에서 decompress.exe가있는 디렉터리로 전환 한 후 다음 명령을 실행합니다.

  decompress.exe ztme11 ztme11.abap -u

텍스트 편집기를 사용하여 현재 디렉토리를 열고 ztme11.abap, 당신은 암호화하기 전에 코드를 볼 수 있습니다