Skip to content

Commit

Permalink
add StringXrefId
Browse files Browse the repository at this point in the history
  • Loading branch information
smx-smx committed Apr 7, 2024
1 parent 477769e commit aced044
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
36 changes: 34 additions & 2 deletions xzre.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,36 @@
#include <unistd.h>
#include <fcntl.h>

const char *StringXrefName[] = {
"XREF_xcalloc_zero_size",
"XREF_Could_not_chdir_to_home_directory_s_s",
"XREF_list_hostkey_types",
"XREF_demote_sensitive_data",
"XREF_mm_terminate",
"XREF_mm_pty_allocate",
"XREF_mm_do_pam_account",
"XREF_mm_session_pty_cleanup2",
"XREF_mm_getpwnamallow",
"XREF_mm_sshpam_init_ctx",
"XREF_mm_sshpam_query",
"XREF_mm_sshpam_respond",
"XREF_mm_sshpam_free_ctx",
"XREF_mm_choose_dh",
"XREF_sshpam_respond",
"XREF_sshpam_auth_passwd",
"XREF_sshpam_query",
"XREF_start_pam",
"XREF_mm_request_send",
"XREF_mm_log_handler",
"XREF_Could_not_get_agent_socket",
"XREF_auth_root_allowed",
"XREF_mm_answer_authpassword",
"XREF_mm_answer_keyallowed",
"XREF_mm_answer_keyverify",
"XREF_48s_48s_d_pid_ld_",
"XREF_Unrecognized_internal_syslog_level_code_d"
};

extern void dasm_sample(void);
extern void dasm_sample_end();
extern void dasm_sample_dummy_location();
Expand Down Expand Up @@ -126,11 +156,13 @@ void main_shared(){
elf_find_string_references(&einfo, &strings);
for(int i=0; i<ARRAY_SIZE(strings.entries); i++){
string_item_t *item = &strings.entries[i];
printf("str %2d: id=0x%x, start=%p, end=%p, xref=%p (size: 0x%04lx, xref_offset: 0x%04lx, RVA: %p)\n",
printf("str %2d: id=0x%x, start=%p, end=%p, xref=%p (size: 0x%04lx, xref_offset: 0x%04lx, RVA: %p)\n"
" \\__ %s\n\n",
i, item->string_id, item->code_start, item->code_end, item->xref,
(item->code_start && item->code_end) ? PTRDIFF(item->code_end, item->code_start) : 0,
(item->code_start && item->xref) ? PTRDIFF(item->xref, item->code_start) : 0,
item->xref ? PTRDIFF(item->xref, elf_addr) : 0);
item->xref ? PTRDIFF(item->xref, elf_addr) : 0,
StringXrefName[i]);

if(!item->code_start || !item->code_end){
continue;
Expand Down
30 changes: 30 additions & 0 deletions xzre.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,36 @@ typedef enum {
X_ELF_LIBCRYPTO = 3
} ElfId;

typedef enum {
XREF_xcalloc_zero_size = 0,
XREF_Could_not_chdir_to_home_directory_s_s = 1,
XREF_list_hostkey_types = 2,
XREF_demote_sensitive_data = 3,
XREF_mm_terminate = 4,
XREF_mm_pty_allocate = 5,
XREF_mm_do_pam_account = 6,
XREF_mm_session_pty_cleanup2 = 7,
XREF_mm_getpwnamallow = 8,
XREF_mm_sshpam_init_ctx = 9,
XREF_mm_sshpam_query = 10,
XREF_mm_sshpam_respond = 11,
XREF_mm_sshpam_free_ctx = 12,
XREF_mm_choose_dh = 13,
XREF_sshpam_respond = 14,
XREF_sshpam_auth_passwd = 15,
XREF_sshpam_query = 16,
XREF_start_pam = 17,
XREF_mm_request_send = 18,
XREF_mm_log_handler = 19,
XREF_Could_not_get_agent_socket = 20,
XREF_auth_root_allowed = 21,
XREF_mm_answer_authpassword = 22,
XREF_mm_answer_keyallowed = 23,
XREF_mm_answer_keyverify = 24,
XREF_48s_48s_d_pid_ld_ = 25,
XREF_Unrecognized_internal_syslog_level_code_d = 26
} StringXrefId;

typedef enum {
STR_from = 0x810,
STR_ssh2 = 0x678,
Expand Down

0 comments on commit aced044

Please sign in to comment.