diff --git a/13.txt b/13.txt new file mode 100644 index 0000000..acb7b76 --- /dev/null +++ b/13.txt @@ -0,0 +1,668 @@ +==7165== Memcheck, a memory error detector +==7165== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. +==7165== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info +==7165== Command: ./rhost +==7165== Parent PID: 3607 +==7165== +==7165== Conditional jump or move depends on uninitialised value(s) +==7165== at 0x6205146: ____strtol_l_internal (in /usr/lib64/libc-2.17.so) +==7165== by 0x62018FF: atoi (in /usr/lib64/libc-2.17.so) +==7165== by 0x405EC9: rule (rhost.c:357) +==7165== by 0x404F76: main (rhost.c:740) +==7165== Uninitialised value was created by a stack allocation +==7165== at 0x405D63: rule (rhost.c:287) +==7165== +==7165== +==7165== HEAP SUMMARY: +==7165== in use at exit: 6,957 bytes in 67 blocks +==7165== total heap usage: 57,864 allocs, 57,797 frees, 10,950,962 bytes allocated +==7165== +==7165== 3 bytes in 1 blocks are still reachable in loss record 1 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x6256B89: strdup (in /usr/lib64/libc-2.17.so) +==7165== by 0x7A0BE34: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16329: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 3 bytes in 1 blocks are still reachable in loss record 2 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x6256B89: strdup (in /usr/lib64/libc-2.17.so) +==7165== by 0x7A0BE34: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1639B: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 4 bytes in 1 blocks are still reachable in loss record 3 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x6256B89: strdup (in /usr/lib64/libc-2.17.so) +==7165== by 0x7A0BE34: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1633C: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 4 bytes in 1 blocks are still reachable in loss record 4 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x6256B89: strdup (in /usr/lib64/libc-2.17.so) +==7165== by 0x7A0BE34: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A163AE: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 5 bytes in 1 blocks are still reachable in loss record 5 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x6256B89: strdup (in /usr/lib64/libc-2.17.so) +==7165== by 0x7A0BE34: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16316: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 5 bytes in 1 blocks are still reachable in loss record 6 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x6256B89: strdup (in /usr/lib64/libc-2.17.so) +==7165== by 0x7A0BE34: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16362: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 5 bytes in 1 blocks are still reachable in loss record 7 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x6256B89: strdup (in /usr/lib64/libc-2.17.so) +==7165== by 0x7A0BE34: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A163C1: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 6 bytes in 1 blocks are still reachable in loss record 8 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x6256B89: strdup (in /usr/lib64/libc-2.17.so) +==7165== by 0x7A0BE34: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16303: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 6 bytes in 1 blocks are still reachable in loss record 9 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x6256B89: strdup (in /usr/lib64/libc-2.17.so) +==7165== by 0x7A0BE34: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16375: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 6 bytes in 1 blocks are still reachable in loss record 10 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x7A10747: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16439: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 7 bytes in 1 blocks are still reachable in loss record 11 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x6256B89: strdup (in /usr/lib64/libc-2.17.so) +==7165== by 0x7A0BE34: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1634F: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 7 bytes in 1 blocks are still reachable in loss record 12 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x6256B89: strdup (in /usr/lib64/libc-2.17.so) +==7165== by 0x7A0BE34: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16388: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 13 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0BE20: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16303: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 14 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0BE20: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16316: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 15 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0BE20: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16329: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 16 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0BE20: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1633C: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 17 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0BE20: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1634F: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 18 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0BE20: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16362: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 19 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0BE20: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16375: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 20 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0BE20: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16388: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 21 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0BE20: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1639B: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 22 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0BE20: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A163AE: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 23 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0BE20: PR_NewLogModule (in /usr/lib64/libnspr4.so) +==7165== by 0x7A163C1: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 24 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A093CE: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1645E: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 24 bytes in 1 blocks are still reachable in loss record 25 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x7A16202: PR_ErrorInstallTable (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16468: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 32 bytes in 1 blocks are still reachable in loss record 26 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x659960F: _dlerror_run (in /usr/lib64/libdl-2.17.so) +==7165== by 0x6599040: dlopen@@GLIBC_2.2.5 (in /usr/lib64/libdl-2.17.so) +==7165== by 0x7A11463: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A162F2: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 40 bytes in 1 blocks are still reachable in loss record 27 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x7A08F7B: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A23236: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A23340: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16424: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 40 bytes in 1 blocks are still reachable in loss record 28 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x7A08F7B: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A23236: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A2335E: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16424: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 40 bytes in 1 blocks are still reachable in loss record 29 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x7A08F7B: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A23236: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A2337C: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16424: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 40 bytes in 1 blocks are still reachable in loss record 30 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A10731: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16439: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 48 bytes in 1 blocks are still reachable in loss record 31 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x7A08F69: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A23236: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A23340: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16424: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 48 bytes in 1 blocks are still reachable in loss record 32 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x7A08F69: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A23236: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A2335E: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16424: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 48 bytes in 1 blocks are still reachable in loss record 33 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x7A08F69: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A23236: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A2337C: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16424: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 64 bytes in 1 blocks are still reachable in loss record 34 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x7A1F222: PR_NewCondVar (in /usr/lib64/libnspr4.so) +==7165== by 0x7A25970: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16413: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 64 bytes in 1 blocks are still reachable in loss record 35 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0FB06: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1641D: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 64 bytes in 1 blocks are still reachable in loss record 36 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x7A1F222: PR_NewCondVar (in /usr/lib64/libnspr4.so) +==7165== by 0x7A23317: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16424: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 64 bytes in 1 blocks are still reachable in loss record 37 of 60 +==7165== at 0x4C2B067: malloc (vg_replace_malloc.c:380) +==7165== by 0x7A1F222: PR_NewCondVar (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1644D: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 38 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A15B88: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A163EE: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 39 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A0BD49: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A163F4: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 40 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A163FE: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 41 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A25961: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16413: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 42 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A0FC48: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1641D: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 43 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A23308: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16424: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 44 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A23323: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16424: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 45 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A09140: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A2332F: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16424: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 46 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A177A8: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16429: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 47 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A0C1A5: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16434: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 48 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F619: PR_NewMonitor (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1F708: PR_NewNamedMonitor (in /usr/lib64/libnspr4.so) +==7165== by 0x7A107EB: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16439: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 49 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1643E: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 50 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A13498: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16459: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 51 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A134A4: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A16459: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 52 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A093B8: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1645E: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 53 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x7A267D7: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 54 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F619: PR_NewMonitor (in /usr/lib64/libnspr4.so) +==7165== by 0x7A267E3: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 55 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED59: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 56 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED65: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 168 bytes in 1 blocks are still reachable in loss record 57 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F17C: PR_NewLock (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED71: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 264 bytes in 1 blocks are still reachable in loss record 58 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A0FA1D: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1641D: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 1,024 bytes in 1 blocks are still reachable in loss record 59 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A10312: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A163E9: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== 1,344 bytes in 8 blocks are still reachable in loss record 60 of 60 +==7165== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117) +==7165== by 0x7A1F619: PR_NewMonitor (in /usr/lib64/libnspr4.so) +==7165== by 0x7A0FA59: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x7A1641D: ??? (in /usr/lib64/libnspr4.so) +==7165== by 0x4E7ED54: ??? (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E664F4: curl_global_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4E66657: curl_easy_init (in /usr/lib64/libcurl.so.4.3.0) +==7165== by 0x4057B7: GET_PUBLIC_IP (rhost.c:52) +==7165== by 0x404D2B: main (rhost.c:612) +==7165== +==7165== LEAK SUMMARY: +==7165== definitely lost: 0 bytes in 0 blocks +==7165== indirectly lost: 0 bytes in 0 blocks +==7165== possibly lost: 0 bytes in 0 blocks +==7165== still reachable: 6,957 bytes in 67 blocks +==7165== suppressed: 0 bytes in 0 blocks +==7165== +==7165== For lists of detected and suppressed errors, rerun with: -s +==7165== ERROR SUMMARY: 2352 errors from 1 contexts (suppressed: 0 from 0) diff --git a/README.md b/README.md index 0ae6f6f..38c6682 100644 --- a/README.md +++ b/README.md @@ -3,17 +3,20 @@ 支持钉钉告警和邮件告警 支持第三方QQ邮箱告警 支持一次运行检测、后台运行检测 +支持系统病毒扫描 ``` -Debian系统请安装libcurl、iptables-devel、libclamav-devel - apt install libclamav-dev libip4tc-dev libcurl4-openssl-dev #(或者libcurl4-gnutls-dev) +Debian系统请安装libcurl、iptables-devel、libclamav-dev + apt install libclamav-dev libip4tc-dev libcurl4-openssl-dev #(或者libcurl4-gnutls-dev) + apt install libsystemd-dev libjson-c-dev libpcre2-dev freshclam # 更新病毒库(必要) ``` ``` Centos 7系统请安装libcurl、iptables-devel、libclamav-devel - yum install clamav clamav-update clamav-lib - yum install iptables-devel libcurl-devel + yum install clamav clamav-update clamav-lib clamav-devel json-c-devel pcre2-devel + yum install iptables-devel libcurl-devel + yum install systemd-devel freshclam # 更新病毒库(必要) ``` @@ -24,18 +27,19 @@ cd /root git clone https://git.aixiao.me/aixiao/denyhosts cd denyhosts make clean; make -chmod a+x /root/denyhosts/denyhosts.sh -crontab 定时任务,像这样. -0 22 * * * /root/denyhosts/denyhosts.sh +启动: +./rhost -d -r / --exclude-dir="^/sys|^/dev|^/proc|^/opt/infected|^/root|^/home" --move=/opt/infected --max-filesize 1024M -l clamscan.log # 用户指定参数,后台运行并扫描病毒 - -示列: -./rhost -d -r / --exclude-dir="^/sys|^/dev|^/proc|^/opt/infected|^/root|^/home" --move=/opt/infected --max-filesize 1024M -l clamscan.log #后台运行并扫描病毒 +./rhost -d # 后台运行读取配置文件参数 ./rhost # 只处理非法攻击 +关闭 +killall rhost + + ``` @@ -64,7 +68,8 @@ global { REFUSE_NUMBER = 3; // 拒绝攻击次数 CLAMAV = 1; // clamav 是否扫描病毒(测试阶段)(1开启,非1关闭) - CLAMAV_TIME = "* 22 21 * * *"; // clamav 扫描时间(Cron格式, 秒 分 时 天 月 周) + CLAMAV_ARG = "-r / --exclude-dir="^/sys|^/dev|^/proc|^/opt/infected|^/root|^/home|^/mnt" --move=/opt/infected --max-filesize 1024M -l clamscan.log"; + CLAMAV_TIME = "* 17 13 * * *"; // clamav 扫描时间(Cron格式, 秒 分 时 天 月 周) IPV4_RESTRICTION = 1; // 是否启用IP白名单(1开启,非1关闭) @@ -91,4 +96,5 @@ global { + ``` diff --git a/ccronexpr.o b/ccronexpr.o new file mode 100644 index 0000000..a4a1550 Binary files /dev/null and b/ccronexpr.o differ diff --git a/clamscan/clamscan.o b/clamscan/clamscan.o new file mode 100644 index 0000000..041287b Binary files /dev/null and b/clamscan/clamscan.o differ diff --git a/clamscan/manager.o b/clamscan/manager.o new file mode 100644 index 0000000..dcd80cc Binary files /dev/null and b/clamscan/manager.o differ diff --git a/clamscan/shared/actions.o b/clamscan/shared/actions.o new file mode 100644 index 0000000..fee39e8 Binary files /dev/null and b/clamscan/shared/actions.o differ diff --git a/clamscan/shared/cdiff.o b/clamscan/shared/cdiff.o new file mode 100644 index 0000000..8586bd2 Binary files /dev/null and b/clamscan/shared/cdiff.o differ diff --git a/clamscan/shared/cert_util.o b/clamscan/shared/cert_util.o new file mode 100644 index 0000000..685854b Binary files /dev/null and b/clamscan/shared/cert_util.o differ diff --git a/clamscan/shared/clamdcom.o b/clamscan/shared/clamdcom.o new file mode 100644 index 0000000..447e6f4 Binary files /dev/null and b/clamscan/shared/clamdcom.o differ diff --git a/clamscan/shared/getopt.o b/clamscan/shared/getopt.o new file mode 100644 index 0000000..5b65826 Binary files /dev/null and b/clamscan/shared/getopt.o differ diff --git a/clamscan/shared/hostid.o b/clamscan/shared/hostid.o new file mode 100644 index 0000000..bcfa2ab Binary files /dev/null and b/clamscan/shared/hostid.o differ diff --git a/clamscan/shared/idmef_logging.o b/clamscan/shared/idmef_logging.o new file mode 100644 index 0000000..e173d51 Binary files /dev/null and b/clamscan/shared/idmef_logging.o differ diff --git a/clamscan/shared/libshared.a b/clamscan/shared/libshared.a new file mode 100644 index 0000000..5eafc50 Binary files /dev/null and b/clamscan/shared/libshared.a differ diff --git a/clamscan/shared/misc.o b/clamscan/shared/misc.o new file mode 100644 index 0000000..951bd52 Binary files /dev/null and b/clamscan/shared/misc.o differ diff --git a/clamscan/shared/optparser.o b/clamscan/shared/optparser.o new file mode 100644 index 0000000..82a494f Binary files /dev/null and b/clamscan/shared/optparser.o differ diff --git a/clamscan/shared/output.o b/clamscan/shared/output.o new file mode 100644 index 0000000..61fb19b Binary files /dev/null and b/clamscan/shared/output.o differ diff --git a/clamscan/shared/tar.o b/clamscan/shared/tar.o new file mode 100644 index 0000000..3cc329a Binary files /dev/null and b/clamscan/shared/tar.o differ diff --git a/conf.c b/conf.c index dc0cea6..6c5af7a 100644 --- a/conf.c +++ b/conf.c @@ -132,7 +132,7 @@ static void parse_global_module(char *content, conf * conf) val_begin_len = val_end - val_begin; conf->IS_QQMAIL = atoi(val_begin); } - +/* if (strcasecmp(var, "SEND_QQ") == 0) { val_begin_len = val_end - val_begin; if (copy_new_mem(val_begin, val_begin_len, &conf->SEND_QQ) != 0) @@ -144,7 +144,7 @@ static void parse_global_module(char *content, conf * conf) if (copy_new_mem(val_begin, val_begin_len, &conf->QQMAIL_KEY) != 0) return; } - +*/ if (strcasecmp(var, "RECV_MAIL") == 0) { val_begin_len = val_end - val_begin; if (copy_new_mem(val_begin, val_begin_len, &conf->RECV_MAIL) != 0) @@ -194,6 +194,12 @@ static void parse_global_module(char *content, conf * conf) if (copy_new_mem(val_begin, val_begin_len, &conf->CLAMAV_TIME) != 0) return; } + if (strcasecmp(var, "CLAMAV_ARG") == 0) { + val_begin_len = val_end - val_begin; + conf->CLAMAV_TIME_LEN = val_begin_len; + if (copy_new_mem(val_begin, val_begin_len, &conf->CLAMAV_ARG) != 0) + return; + } content = strchr(lineEnd + 1, '\n'); } @@ -207,10 +213,12 @@ static char *read_module(char *buff, const char *module_name) len = strlen(module_name); p = buff; - while (1) { + while (1) + { while (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n') p++; - if (strncasecmp(p, module_name, len) == 0) { + if (strncasecmp(p, module_name, len) == 0) + { p += len; while (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n') p++; @@ -262,10 +270,12 @@ void free_conf(conf * conf) free(conf->PHONE); if (conf->DING_WEBHOOK) free(conf->DING_WEBHOOK); + /* if (conf->SEND_QQ) free(conf->SEND_QQ); if (conf->QQMAIL_KEY) free(conf->QQMAIL_KEY); + */ if (conf->RECV_MAIL) free(conf->RECV_MAIL); if (conf->PUBLIC_IP) @@ -280,6 +290,8 @@ void free_conf(conf * conf) if (conf->CLAMAV_TIME) free(conf->CLAMAV_TIME); + if (conf->CLAMAV_ARG) + free(conf->CLAMAV_ARG); return; @@ -298,10 +310,12 @@ void ptintf_conf(conf * conf) if (conf->DING_WEBHOOK) printf("%s\n", conf->DING_WEBHOOK); printf("%d\n", conf->IS_QQMAIL); + /* if (conf->SEND_QQ) printf("%s\n", conf->SEND_QQ); if (conf->QQMAIL_KEY) printf("%s\n", conf->QQMAIL_KEY); + */ if (conf->RECV_MAIL) printf("%s\n", conf->RECV_MAIL); if (conf->PUBLIC_IP) @@ -321,7 +335,8 @@ void split_string(char string[], char delims[], char (*whitelist_ip)[WHITELIST_I int i = 0; char *result = NULL; result = strtok(string, delims); - while (result != NULL) { + while (result != NULL) + { i++; strcpy(whitelist_ip[i], result); result = strtok(NULL, delims); diff --git a/conf.h b/conf.h index 81b3c54..e1af675 100644 --- a/conf.h +++ b/conf.h @@ -9,7 +9,8 @@ #define WHITELIST_IP_NUM 1024 -typedef struct CONF { +typedef struct CONF +{ char *DAEMON; int TIME; @@ -17,6 +18,7 @@ typedef struct CONF { int CLAMAV; char *CLAMAV_TIME; int CLAMAV_TIME_LEN; + char *CLAMAV_ARG; int IS_BLOCKED; int REFUSE_NUMBER; @@ -35,13 +37,15 @@ typedef struct CONF { int IS_MAIL; + // 钉钉 int IS_DING_WEBHOOK; char *PHONE; char *DING_WEBHOOK; + // 第三方邮箱 int IS_QQMAIL; - char *SEND_QQ; - char *QQMAIL_KEY; + //char *SEND_QQ; + //char *QQMAIL_KEY; char *RECV_MAIL; } conf; diff --git a/conf.o b/conf.o new file mode 100644 index 0000000..0513055 Binary files /dev/null and b/conf.o differ diff --git a/libiptc.c b/libiptc.c index 8429ed7..b39324e 100644 --- a/libiptc.c +++ b/libiptc.c @@ -44,6 +44,8 @@ int show_all_rule(char *ipv4) break; } } + + iptc_free(handle); return r; } @@ -209,6 +211,8 @@ int iptc_add_rule(const char *table, const char *chain, int protocol, const char free(entry_match); free(entry_target); free(chain_entry); + + iptc_free(handle); return 0; } diff --git a/libiptc.o b/libiptc.o new file mode 100644 index 0000000..e941762 Binary files /dev/null and b/libiptc.o differ diff --git a/rhost b/rhost new file mode 100644 index 0000000..9987d37 Binary files /dev/null and b/rhost differ diff --git a/rhost.c b/rhost.c index c8c6f1a..853b601 100644 --- a/rhost.c +++ b/rhost.c @@ -9,7 +9,8 @@ // 存储公网IP char *public_ip; -struct MemoryStruct { +struct MemoryStruct +{ char *memory; size_t size; }; @@ -21,7 +22,8 @@ static size_t WriteMemoryCallback(void *contents, size_t size, size_t nmemb, voi // 注意这里根据每次被调用获得的数据重新动态分配缓存区的大小 char *ptr = realloc(mem->memory, mem->size + realsize + 1); - if (ptr == NULL) { + if (ptr == NULL) + { /* 内存不足! */ printf("not enough memory (realloc returned NULL)\n"); return 0; @@ -62,9 +64,12 @@ static char *GET_PUBLIC_IP(char *URL) //对于同一次阻塞的curl_easy_perform而言,在写完获取的数据之前,会多次调用 WriteMemoryCallback res = curl_easy_perform(curl_handle); - if (res != CURLE_OK) { + if (res != CURLE_OK) + { fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); - } else { + } + else + { //printf("%lu bytes retrieved\n", (unsigned long)chunk.size); //printf("%s", chunk.memory); ; @@ -79,9 +84,11 @@ static char *GET_PUBLIC_IP(char *URL) // 检测系统 int check_system() { - if (0 == access("/etc/debian_version", F_OK)) { + if (0 == access("/etc/debian_version", F_OK)) + { return DEBISN_SYSTEM; - } else if (0 == access("/etc/centos-release", F_OK)) { + } else if (0 == access("/etc/centos-release", F_OK)) + { return CENTOS_SYSTEM; } @@ -100,7 +107,8 @@ int dingding_warning(char *illegal_ip, char *public_ip, conf * conf) strcpy(temp, public_ip); temp[strlen(public_ip) - 1] = '\0'; - if ((fp = fopen("libcurl_ding.log", "wt+")) == NULL) { + if ((fp = fopen("libcurl.log", "wt+")) == NULL) + { return 1; } @@ -109,7 +117,8 @@ int dingding_warning(char *illegal_ip, char *public_ip, conf * conf) curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); - if (curl == NULL) { + if (curl == NULL) + { return 1; } #define JSIN "{ \ @@ -165,11 +174,13 @@ int mail_warning(char *illegal_ip, char *public_ip, conf * conf) temp[strlen(public_ip) - 1] = '\0'; sprintf(text, "echo \"主机:%s, 禁止%s访问\" | mail -s \"System ban IP\" %s", temp, illegal_ip, conf->RECV_MAIL); - if (NULL == (fp = popen(text, "r"))) { + if (NULL == (fp = popen(text, "r"))) + { perror("popen text"); } - while (fgets(buff, BUFFER, fp) != NULL) { + while (fgets(buff, BUFFER, fp) != NULL) + { buff[strlen(buff) - 1] = '\0'; } @@ -182,11 +193,11 @@ int mail_warning(char *illegal_ip, char *public_ip, conf * conf) // 第三方邮箱告警 int QQ_mail_warning(char *illegal_ip, char *public_ip, conf * conf) { - char string[BUFFER + (sizeof(QQMAIL))]; + char string[BUFFER + (sizeof(QQMAIL)) + 1]; char text[BUFFER]; char temp[32]; - memset(string, 0, BUFFER + (sizeof(QQMAIL))); + memset(string, 0, BUFFER + (sizeof(QQMAIL)) + 1); memset(text, 0, BUFFER); memset(temp, 0, 32); @@ -204,11 +215,14 @@ int whitelist(char *client_ip, char (*whitelist_ip)[WHITELIST_IP_NUM]) { int i; - for (i = 1; i < WHITELIST_IP_NUM - 1; i++) { - if (strcmp(whitelist_ip[i], "\0") == 0) { // 如果字符串为空就跳出循环 + for (i = 1; i < WHITELIST_IP_NUM - 1; i++) + { + if (strcmp(whitelist_ip[i], "\0") == 0) // 如果字符串为空就跳出循环 + { break; } - if ((strncmp(client_ip, whitelist_ip[i], strlen(whitelist_ip[i]))) == 0) { // 对比client_ip长度, + if ((strncmp(client_ip, whitelist_ip[i], strlen(whitelist_ip[i]))) == 0) // 对比client_ip长度, + { return 1; } } @@ -222,16 +236,18 @@ int isregion(char *str, char (*region_list)[WHITELIST_IP_NUM]) int i; char *p; - for (i = 1; i < WHITELIST_IP_NUM - 1; i++) { - if (strcmp(region_list[i], "\0") == 0) { // 如果字符串为空就跳出循环 + for (i = 1; i < WHITELIST_IP_NUM - 1; i++) + { + if (strcmp(region_list[i], "\0") == 0) // 如果字符串为空就跳出循环 + { break; } // 在str中查找region_list[i] p = strstr(str, region_list[i]); - if (p != NULL) { + if (p != NULL) + { return 1; } - } return 0; @@ -240,18 +256,22 @@ int isregion(char *str, char (*region_list)[WHITELIST_IP_NUM]) // 去除空格 char *remove_space(const char *str) { + unsigned int i = 0, j = 0; unsigned int uLen = strlen(str); + char *strRet; - if (0 == uLen) { + if (0 == uLen) + { return '\0'; } - char *strRet = (char *)malloc(uLen + 1); + strRet = (char *)malloc(uLen + 1); memset(strRet, 0, uLen + 1); - unsigned int i = 0, j = 0; - for (i = 0; i < uLen + 1; i++) { - if (str[i] != ' ') { + for (i = 0; i < uLen + 1; i++) + { + if (str[i] != ' ') + { strRet[j++] = str[i]; } } @@ -263,7 +283,6 @@ char *remove_space(const char *str) // 封禁非法IP int rule(conf * conf) { - int i; char whitelist_ip[WHITELIST_IP_NUM][WHITELIST_IP_NUM] = { { 0 }, { 0 } }; char region_list[WHITELIST_IP_NUM][WHITELIST_IP_NUM] = { { 0 }, { 0 } }; @@ -272,57 +291,75 @@ int rule(conf * conf) time_t timep; struct tm *tp; - i = 0; + fp = NULL; fc = NULL; - time(&timep); + timep = time(NULL); tp = localtime(&timep); memset(splice_command, 0, LONG_BUFFER); memset(command, 0, LONG_BUFFER); memset(buffer, 0, BUFFER); memset(awk, 0, BUFFER); + if (DEBISN_SYSTEM == check_system()) // Debian 系统规则 { - if (tp->tm_mday >= 10) { - if ((fp = popen(GE_10, "r")) == NULL) { + if (tp->tm_mday >= 10) + { + if ((fp = popen(GE_10, "r")) == NULL) + { perror("GE_10"); return 1; } - } else { - if ((fp = popen(LE_10, "r")) == NULL) { + } + else + { + if ((fp = popen(LE_10, "r")) == NULL) + { perror("LE_10"); return 1; } } - } else if (CENTOS_SYSTEM == check_system()) // Centos 7系统规则 + } + else if (CENTOS_SYSTEM == check_system()) // Centos 7系统规则 { - if (tp->tm_mday >= 10) { - if ((fp = popen(CENTOS_GE_10, "r")) == NULL) { + if (tp->tm_mday >= 10) + { + if ((fp = popen(CENTOS_GE_10, "r")) == NULL) + { perror("CENTOS_GE_10"); return 1; } - } else { - if ((fp = popen(CENTOS_LE_10, "r")) == NULL) { + } + else + { + if ((fp = popen(CENTOS_LE_10, "r")) == NULL) + { perror("CENTOS_LE_10"); return 1; } } - } else { + } + else + { + return UNKNOWN_SYSTEM; } - while (fgets(buffer, BUFFER, fp) != NULL) { + + while (fgets(buffer, BUFFER, fp) != NULL) + { temp = strstr(buffer, "rhost"); sscanf(temp, "rhost=%s", temp); - if (atoi(strncpy(p, temp, 1)) > 0) { + if (atoi(strncpy(p, temp, 1)) > 0) + { strcat(splice_command, temp); strcat(splice_command, "\n"); } } - - printf("%s", splice_command); // 打印所有非法IP + + printf("%s", splice_command); // 打印所有非法IP sprintf(awk, AWK, conf->REFUSE_NUMBER); // 拼接命令 strcpy(command, "echo \""); @@ -330,64 +367,54 @@ int rule(conf * conf) strcat(command, "\""); strcat(command, awk); - if ((fp = popen(command, "r")) == NULL) // 执行命令 + if ((fc = popen(command, "r")) == NULL) // 执行命令 { perror("popen command"); return 1; } - while (fgets(buffer, BUFFER, fp) != NULL) // 执行命令后, 为空时就不会 + while (fgets(buffer, BUFFER, fc) != NULL) // 执行命令后, 为空时就不会 { buffer[strlen(buffer) - 1] = '\0'; // 去除回车 split_string(conf->IPV4_WHITE_LIST, " ", whitelist_ip); split_string(conf->REGION_LIST, " ", region_list); - // 打印配置 - for (i = 1; i <= WHITELIST_IP_NUM - 1; i++) { - if (*whitelist_ip[i] != '\0') { - ; - //printf("%s\n", whitelist_ip[i]); - } - } - for (i = 1; i <= WHITELIST_IP_NUM - 1; i++) { - if (*region_list[i] != '\0') { - ; - //printf("%s\n", region_list[i]); - } - } - - if (conf->IPV4_RESTRICTION == 1) { // 是否启用白名单 - if (whitelist(buffer, whitelist_ip) == 1) { - ; + if (conf->IPV4_RESTRICTION == 1) // 是否启用白名单 + { + if (whitelist(buffer, whitelist_ip) == 1) + { printf("白名单IPV4:%s\n", buffer); - continue; } } - if (0 != show_all_rule(buffer)) // libiptc库判断否存在规则 + if (0 != show_all_rule(buffer)) // libiptc库判断否存在规则 { char *location = NULL; char *location_json = NULL; char iplocation[BUFFER]; - char URL[BUFFER + 70]; + char temp[BUFFER]; + char *p; + char *p1; + memset(URL, 0, BUFFER + 70); //sprintf(URL, "http://opendata.baidu.com/api.php?query=%s&co=&resource_id=6006&oe=utf8", buffer); sprintf(URL, conf->REGION_URL, buffer); - printf("%s\n", URL); + //printf("%s\n", URL); location_json = GET_PUBLIC_IP(URL); - if (NULL == location_json) { + if (NULL == location_json) + { printf("获取IP位置错误!\n"); - goto BLOCKED; - } else { - char temp[BUFFER]; - char *p = strstr(location_json, "\"location\""); - char *p1 = strstr(p, "\","); + } + else + { + p = strstr(location_json, "\"location\""); + p1 = strstr(p, "\","); memset(temp, 0, BUFFER); memcpy(temp, p + 12, p1 - p - 12); @@ -399,13 +426,18 @@ int rule(conf * conf) strcat(iplocation, "("); strcat(iplocation, location); strcat(iplocation, ")"); - + + if (location) + free(location); + if (location_json) + free(location_json); + // 地域白名单 - if (conf->REGION == 1) { - if (isregion(iplocation, region_list) == 1) { - ; + if (conf->REGION == 1) + { + if (isregion(iplocation, region_list) == 1) + { printf("地域白名单: %s\n", iplocation); - continue; } @@ -417,29 +449,29 @@ int rule(conf * conf) sleep(3); } - if (conf->IS_MAIL == 1) // 邮件告警 + if (conf->IS_MAIL == 1) // 邮件告警 { mail_warning(iplocation, public_ip, conf); sleep(3); } - if (conf->IS_QQMAIL == 1) // 邮件告警 + if (conf->IS_QQMAIL == 1) // 邮件告警 { QQ_mail_warning(iplocation, public_ip, conf); sleep(3); } + BLOCKED: // 是否封禁攻击IP - if (conf->IS_BLOCKED == 1) { + if (conf->IS_BLOCKED == 1) + { // libiptc 库插入规则 iptables -t filter -A INPUT -p tcp -m tcp -s xxxx -j DROP unsigned int srcIp; inet_pton(AF_INET, buffer, &srcIp); iptc_add_rule("filter", "INPUT", IPPROTO_TCP, NULL, NULL, srcIp, 0, NULL, NULL, "DROP", NULL, 1); } - free(location); - free(location_json); } } @@ -466,6 +498,7 @@ static void sig_child(int signo) static int get_executable_path(char *processdir, char *processname, int len) { char *filename; + if (readlink("/proc/self/exe", processdir, len) <= 0) return -1; filename = strrchr(processdir, '/'); @@ -481,14 +514,16 @@ static int get_executable_path(char *processdir, char *processname, int len) int process_argv(int argc, char *argv[], char **argvs) { argvs[0] = argv[0]; - - for (int i = 0; i <= argc - 1; i++) { - if (i == 1) { - for (int j = i; j <= argc - 2; j++) { + int i; + for (i = 0; i <= argc - 1; i++) + { + if (i == 1) + { + for (int j = i; j <= argc - 2; j++) + { argvs[j] = argv[j + 1]; } } - } return 0; @@ -496,12 +531,10 @@ int process_argv(int argc, char *argv[], char **argvs) int _crontab(struct tm **calnext, char *string) { - const char *err = NULL; time_t cur; time_t datenext; - time(&cur); cron_expr parsed; cron_parse_expr(string, &parsed, &err); @@ -510,29 +543,66 @@ int _crontab(struct tm **calnext, char *string) assert(*calnext); return 0; - } int main(int argc, char *argv[], char **env) { signal(SIGCHLD, sig_child); // 创建捕捉子进程退出信号 - char **head_argvs; - char *argvs[20] = { malloc(sizeof(char *)) }; - process_argv(argc, argv, &(argvs[0])); - head_argvs = &(argvs[0]); // head_argvs指向argvs[0] - int head_argc = argc - 1; // 改变argc数 - + int pid; + + // 读取配置 char path[BUFFER] = { 0 }; char executable_filename[BUFFER] = { 0 }; (void)get_executable_path(path, executable_filename, sizeof(path)); strcat(executable_filename, ".conf"); strcat(path, executable_filename); - conf *conf = (struct CONF *)malloc(sizeof(struct CONF)); read_conf(path, conf); //ptintf_conf(conf); + + + // 处理clamav参数 + char **head_argvs; + int head_argc = 0; + char *argvs[ARGS_NUM] = { NULL }; + char args[ARGS_NUM][WHITELIST_IP_NUM] = { { 0 }, { 0 } }; + //printf("%d\n", argc); + if (argc > 3) // 手动输入参数(如果手动输入参数个数大于3个, 则使用用户输入的参数) + { + process_argv(argc, argv, &(argvs[0])); + head_argvs = &(argvs[0]); // head_argvs指向argvs[0] + head_argc = argc - 1; // 改变argc数 + } + else // 读取配置文件参数 + { + argvs[0] = argv[0]; + split_string(conf->CLAMAV_ARG, " ", args); + for (int i=1; iDAEMON, "on")) { + if (0 == strcmp(conf->DAEMON, "on")) + { goto goto_daemon; } - if (argv[1] != NULL && 0 == strcmp(argv[1], "-d")) { + if (argv[1] != NULL && 0 == strcmp(argv[1], "-d")) + { goto_daemon: - +/* if (daemon(1, 1)) // 守护进程 { perror("daemon"); return -1; } +*/ - while (1) { + // 守护进程 + if ((pid = fork()) < 0) { + return 0; + } else if (0 != pid) { + for(int i=1; inow_year = 1900 + p->tm_year; t->now_mon = 1 + p->tm_mon; @@ -594,34 +705,36 @@ goto_daemon: if (pid < 0) { printf("fork error.\n"); return -1; - } else if (pid == 0) { // child process + } + else if (pid == 0) // child process + { int r = 0; r = _clamscan(head_argc, head_argvs); - /* - if(t != NULL) - free(t); - */ _exit(r); - } else { + } + else + { int status = 0; - wait(&status); //wait the end of child process - if (WIFEXITED(status)) { + wait(&status); // wait the end of child process + if (WIFEXITED(status)) + { ; //printf("child process return %d\n", WEXITSTATUS(status)); } - sleep(60); // 跳过这一分钟 + sleep(60); // 跳过这一分钟 } } } - rule(conf); sleep(conf->TIME); } - } else { + } + else + { rule(conf); } @@ -629,6 +742,15 @@ goto_daemon: free_conf(conf); free(conf); free(public_ip); - + + for(int i=1; i -typedef struct now_next_time { +typedef struct now_next_time +{ int now_year; int now_mon; int now_day; @@ -65,16 +66,19 @@ typedef struct now_next_time { static int cronAllocations = 0; static int cronTotalAllocations = 0; static int maxAlloc = 0; -void* cron_malloc(size_t n) { +void* cron_malloc(size_t n) +{ cronAllocations++; cronTotalAllocations++; - if (cronAllocations > maxAlloc) { + if (cronAllocations > maxAlloc) + { maxAlloc = cronAllocations; } return malloc(n); } -void cron_free(void* p) { +void cron_free(void* p) +{ cronAllocations--; free(p); } @@ -88,7 +92,7 @@ void cron_free(void* p) { #define BUFFER 1024 #define LONG_BUFFER 1024*100 - +#define ARGS_NUM 20 #define WHITELIST_IP_NUM 1024 #define AWK " | awk -v num=%d '{a[$1]+=1;} END {for(i in a){if (a[i] >= num) {print i;}}}' " @@ -98,9 +102,9 @@ void cron_free(void* p) { #define CENTOS_GE_10 "grep -E \"^$(LC_ALL=\"C\" date \"+%h\").$(LC_ALL=\"C\" date \"+%d\")\" /var/log/secure | grep failure | grep rhost" #define CENTOS_LE_10 "grep -E \"^$(LC_ALL=\"C\" date \"+%h\")..$(LC_ALL=\"C\" date | awk '{print $3}')\" /var/log/secure | grep failure | grep rhost" - #define QQMAIL "gomail -r %s -s \"System ban IP\" -t \"%s\"" + extern void read_conf(char *filename, conf * configure); extern void free_conf(conf * conf); extern void ptintf_conf(conf * conf); diff --git a/rhost.o b/rhost.o new file mode 100644 index 0000000..4fc8a3c Binary files /dev/null and b/rhost.o differ