Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- grep call foo.txt | wc -l
- 187
- 0:000> bp kernel32!ConsoleClientCallServer
- 0:000> tc 130
- 012f1005 e856000000 call consapp!printf (012f1060)
- 012f1067 e84fa20000 call consapp!__acrt_iob_func (01
- 012f1078 e8a3ffffff call consapp!__local_stdio_print
- 012f1082 e8b9b80100 call consapp!__stdio_common_vfpr
- 0130c9bc e8e6ecfeff call consapp!__crt_seh_guarded_c
- 012fb6ae e8dd63ffff call consapp!__SEH_prolog4 (012f
- 012fb6bc e89cfcffff call consapp!_lock_file (012fb35
- 012fb369 ff154cf03201 call dword ptr [consapp!_imp__En
- 012fb6c9 e81f520000 call consapp!<lambda_df52180bf14
- 0130090b e869780100 call consapp!__acrt_stdio_begin_
- 01318183 e812feffff call consapp!_fileno (01317f9a)
- 01318189 e82bc80000 call consapp!_isatty (013249b9)
- 0131819f e81731feff call consapp!__acrt_iob_func (01
- 013181e8 e88989ffff call consapp!_malloc_base (01310
- 01310ba8 ff15b0f03201 call dword ptr [consapp!_imp__He
- 77115adb e80c000000 call ntdll!RtlpAllocateHeap (771
- 77115af6 e811d1ffff call ntdll!_SEH_prolog4 (77112c0
- 7714a405 e8a4ba0300 call ntdll!RtlDebugAllocateHeap
- 77185eb5 e852cdf8ff call ntdll!_SEH_prolog4 (77112c0
- 77185ef2 e87379f9ff call ntdll!RtlpCheckHeapSignatur
- 77185f46 e84518f8ff call ntdll!RtlEnterCriticalSecti
- 77185f54 e8d5f9ffff call ntdll!RtlpValidateHeap (771
- 77185949 e8cef1ffff call ntdll!RtlpValidateHeapHeade
- 77185f5e e873cef8ff call ntdll!RtlAllocateHeap (7711
- 77115adb e80c000000 call ntdll!RtlpAllocateHeap (771
- 77115af6 e811d1ffff call ntdll!_SEH_prolog4 (77112c0
- 7714a53b e8b0b6faff call ntdll!RtlCompareMemoryUlong
- 77115d55 e890080000 call ntdll!RtlpCreateSplitBlock
- 77149ed4 e8b7bdfaff call ntdll!RtlFillMemoryUlong (7
- 7714a689 e802b6faff call ntdll!RtlFillMemoryUlong (7
- 770eeb45 e8ddffffff call ntdll!RtlpGetExtraStuffPoin
- 770eeb60 e8fe870200 call ntdll!RtlGetNtGlobalFlags (
- 77115db9 e81d000000 call ntdll!RtlpAllocateHeap+0xe7
- 77115dce e87eceffff call ntdll!_SEH_epilog4 (77112c5
- 77185f6a e8adebffff call ntdll!RtlpValidateHeapHeade
- 77185fb1 e8718bf6ff call ntdll!RtlpGetExtraStuffPoin
- 77186082 e8dc12f9ff call ntdll!RtlGetNtGlobalFlags (
- 771861a9 e810000000 call ntdll!RtlDebugAllocateHeap+
- 771861cd e87e15f8ff call ntdll!RtlLeaveCriticalSecti
- 771861b1 e89bcaf8ff call ntdll!_SEH_epilog4 (77112c5
- 77115dce e87eceffff call ntdll!_SEH_epilog4 (77112c5
- 013181f1 e84689ffff call consapp!_free_base (01310b3
- 01300922 e8f3f9ffff call consapp!_LocaleUpdate::_Loc
- 01300957 e88af6ffff call consapp!__crt_stdio_output:
- 012fffee e860ffffff call consapp!__crt_stdio_output:
- 01300966 e828150000 call consapp!__crt_stdio_output:
- 01301e9e e834950000 call consapp!__crt_stdio_output:
- 0130b3f1 e859090000 call consapp!__acrt_stdio_char_t
- 0130bd63 e832c20000 call consapp!_fileno (01317f9a)
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01301ef1 e8d7eeffff call consapp!__crt_stdio_output:
- 01301f0c e84d110000 call consapp!__crt_stdio_output:
- 0130305e e8df010000 call consapp!__crt_stdio_output:
- 0130324d e85b020000 call consapp!__crt_stdio_output:
- 01303265 e8778c0000 call consapp!__crt_stdio_output:
- 0130bf05 e8b6c00000 call consapp!_fputc_nolock (0131
- 01300973 e892fbffff call consapp!__crt_stdio_output:
- 01300515 e822060100 call consapp!_free_base (01310b3
- 01300995 e894780100 call consapp!__acrt_stdio_end_te
- 0131824b e856c4ffff call consapp!__acrt_stdio_flush_
- 013146d6 e8bf380000 call consapp!_fileno (01317f9a)
- 013146dd e8f2bb0000 call consapp!_write (013202d4)
- 013202db e8b017fdff call consapp!__SEH_prolog4 (012f
- 01320333 e878acffff call consapp!__acrt_lowio_lock_f
- 0131afcb ff154cf03201 call dword ptr [consapp!_imp__En
- 01320370 e847000000 call consapp!_write_nolock (0132
- 0132047b e8e4faffff call consapp!write_requires_doub
- 0131ff6f e8454a0000 call consapp!_isatty (013249b9)
- 0131ff97 e81a71ffff call consapp!__acrt_getptd (0131
- 013170ba ff1544f03201 call dword ptr [consapp!_imp__Ge
- 013170cd e8fdc6ffff call consapp!__acrt_FlsGetValue
- 013137f1 e85bfbffff call consapp!try_get_function (0
- 01313804 ff154cf13201 call dword ptr [consapp!__guard_
- 0131380a ffd6 call esi
- 0131381a e898e4fdff call consapp!__security_check_co
- 01317152 ff1548f03201 call dword ptr [consapp!_imp__Se
- 01320516 e8bffaffff call consapp!write_text_ansi_nol
- 0131ffe4 e857af0000 call consapp!_chkstk (0132af40)
- 01320075 ff1584f03201 call dword ptr [consapp!_imp__Wr
- 75e3bf44 e8d4ffffff call kernel32!WriteConsoleA (75e
- 75e3bf30 e8c0feffff call kernel32!WriteConsoleIntern
- 75e3bdff e8dc380000 call kernel32!_SEH_prolog4_GS (7
- 75e3be58 e847050000 call kernel32!memcpy (75e3c3a4)
- 75e3be77 e8a38c0000 call kernel32!ConsoleClientCallS
- Breakpoint 0 hit
- 75e44b1f 8bff mov edi,edi
- 75e44b68 ff158016df75 call dword ptr [kernel32!_imp__N
- 771064a2 ff12 call dword ptr [edx]
- 771070f2 0f34 sysenter <<<<<<<<<<<<<<<<<<<<<<<
- 75e3bea6 e87d380000 call kernel32!_SEH_epilog4_GS (7
- #include <stdio.h>
- #include <sys/types.h>
- #include <unistd.h>
- int main(void) {
- pid_t current_PID = getpid();
- pid_t parent_PID = getppid();
- printf("Current process ID: %dn", current_PID);
- printf("Parent process ID: %dn", parent_PID);
- return 0;
- }
- $ echo $$
- 29760
- $ ./pid
- Current process ID: 9071
- Parent process ID: 29760
- <main>:
- push %ebp
- mov %esp,%ebp
- and $0xfffffff0,%esp
- sub $0x20,%esp
- call 8048340 <getpid@plt> # libc wrapper around getpid() system call
- mov %eax,0x18(%esp) # write return value (PID) in register to stack
- call 8048370 <getppid@plt> # libc wrapper around getppid() system call
- mov %eax,0x1c(%esp) # write return value (PPID) in register to stack
- mov 0x18(%esp),%eax # read from stack, write to register
- mov %eax,0x4(%esp) # write register value to stack as 2nd arg to printf (PID)
- movl $0x8048560,(%esp) # read format string from memory, write to stack as 1st arg to printf
- call 8048330 <printf@plt> # libc wrapper around write() system call
- mov 0x1c(%esp),%eax # read PPID saved on stack, write to register
- mov %eax,0x4(%esp) # write PPID in register to stack as 2nd arg to printf
- movl $0x8048578,(%esp) # read format string from memory, write to stack as 1st arg to printf
- call 8048330 <printf@plt> # libc wrapper around write() system call
- mov $0x0,%eax
- leave
- ret
- $ strace ./pid
- execve("./pid", ["./pid"], [/* 53 vars */]) = 0
- [ Process PID=10017 runs in 32 bit mode. ]
- brk(0) = 0x943d000
- access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
- mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xfffffffff7793000
- access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
- open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
- fstat64(3, {st_mode=S_IFREG|0644, st_size=155012, ...}) = 0
- mmap2(NULL, 155012, PROT_READ, MAP_PRIVATE, 3, 0) = 0xfffffffff776d000
- close(3) = 0
- access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
- open("/lib/i386-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
- read(3, "177ELF111 3 3 1 P2341 004 "..., 512) = 512
- fstat64(3, {st_mode=S_IFREG|0755, st_size=1763068, ...}) = 0
- mmap2(NULL, 1772156, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xfffffffff75bc000
- mmap2(0xf7767000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1aa000) = 0xfffffffff7767000
- mmap2(0xf776a000, 10876, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xfffffffff776a000
- close(3) = 0
- mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xfffffffff75bb000
- set_thread_area(0xffc17c00) = 0
- mprotect(0xf7767000, 8192, PROT_READ) = 0
- mprotect(0x8049000, 4096, PROT_READ) = 0
- mprotect(0xf77b8000, 4096, PROT_READ) = 0
- munmap(0xf776d000, 155012) = 0
- getpid() = 10017
- getppid() = 10014
- fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 13), ...}) = 0
- mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xfffffffff7792000
- write(1, "Current process ID: 10017n", 26Current process ID: 10017
- ) = 26
- write(1, "Parent process ID: 10014n", 25Parent process ID: 10014
- ) = 25
- exit_group(0) = ?
- +++ exited with 0 +++
Add Comment
Please, Sign In to add comment