修复libiptc没有iptc_free(),修复内存泄漏。

This commit is contained in:
aixiao 2022-10-28 21:53:48 +08:00
parent fa5ce31540
commit 9e7c957bf6
27 changed files with 962 additions and 138 deletions

668
13.txt Normal file
View File

@ -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)

View File

@ -3,17 +3,20 @@
支持钉钉告警和邮件告警
支持第三方QQ邮箱告警
支持一次运行检测、后台运行检测
支持系统病毒扫描
```
Debian系统请安装libcurl、iptables-devel、libclamav-devel
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 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 {
```

BIN
ccronexpr.o Normal file

Binary file not shown.

BIN
clamscan/clamscan.o Normal file

Binary file not shown.

BIN
clamscan/manager.o Normal file

Binary file not shown.

BIN
clamscan/shared/actions.o Normal file

Binary file not shown.

BIN
clamscan/shared/cdiff.o Normal file

Binary file not shown.

BIN
clamscan/shared/cert_util.o Normal file

Binary file not shown.

BIN
clamscan/shared/clamdcom.o Normal file

Binary file not shown.

BIN
clamscan/shared/getopt.o Normal file

Binary file not shown.

BIN
clamscan/shared/hostid.o Normal file

Binary file not shown.

Binary file not shown.

BIN
clamscan/shared/libshared.a Normal file

Binary file not shown.

BIN
clamscan/shared/misc.o Normal file

Binary file not shown.

BIN
clamscan/shared/optparser.o Normal file

Binary file not shown.

BIN
clamscan/shared/output.o Normal file

Binary file not shown.

BIN
clamscan/shared/tar.o Normal file

Binary file not shown.

25
conf.c
View File

@ -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);

10
conf.h
View File

@ -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;

BIN
conf.o Normal file

Binary file not shown.

View File

@ -45,6 +45,8 @@ int show_all_rule(char *ipv4)
}
}
iptc_free(handle);
return r;
}
@ -210,5 +212,7 @@ int iptc_add_rule(const char *table, const char *chain, int protocol, const char
free(entry_target);
free(chain_entry);
iptc_free(handle);
return 0;
}

BIN
libiptc.o Normal file

Binary file not shown.

BIN
rhost Normal file

Binary file not shown.

328
rhost.c
View File

@ -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,51 +291,69 @@ 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");
}
@ -330,39 +367,25 @@ 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;
}
}
@ -372,22 +395,26 @@ int rule(conf * conf)
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);
@ -400,12 +427,17 @@ int rule(conf * conf)
strcat(iplocation, location);
strcat(iplocation, ")");
// 地域白名单
if (conf->REGION == 1) {
if (isregion(iplocation, region_list) == 1) {
;
printf("地域白名单: %s\n", iplocation);
if (location)
free(location);
if (location_json)
free(location_json);
// 地域白名单
if (conf->REGION == 1)
{
if (isregion(iplocation, region_list) == 1)
{
printf("地域白名单: %s\n", iplocation);
continue;
}
@ -429,17 +461,17 @@ int rule(conf * 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; i<ARGS_NUM; i++)
{
if (args[i][0] == '\0')
{
continue;
}
else
{
argvs[i] = strdup(args[i]);
head_argc++;
}
}
head_argvs = &(argvs[0]);
head_argc += 1;
}
// 打印clamav参数
for(int i=0; i<head_argc; i++)
{
printf("%s %d\n", head_argvs[i], i);
}
now_next_time *t = (now_next_time *)malloc(sizeof(struct now_next_time));
memset(t, 0, sizeof(struct now_next_time));
@ -541,20 +611,61 @@ int main(int argc, char *argv[], char **env)
//printf("%s", public_ip);
if (0 == strcmp(conf->DAEMON, "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; i<head_argc; i++)
{
if (head_argvs[i])
free(head_argvs[i]);
}
free(t);
free_conf(conf);
free(conf);
free(public_ip);
exit(0);
}
if (setsid() < 0) {
return 0;
}
signal(SIGHUP, SIG_IGN);
if ((pid = fork()) < 0) {
return 0;
} else if (0 != pid) {
for(int i=1; i<head_argc; i++)
{
if (head_argvs[i])
free(head_argvs[i]);
}
free(t);
free_conf(conf);
free(conf);
free(public_ip);
exit(0);
}
while (1)
{
// Cron
struct tm *calnext; //取得Cron规则时间
calnext = (struct tm *)malloc(sizeof(struct tm));
@ -571,7 +682,7 @@ goto_daemon:
// 取得现在时间
time_t timep;
struct tm *p;
time(&timep);
timep = time(NULL);
p = localtime(&timep);
t->now_year = 1900 + p->tm_year;
t->now_mon = 1 + p->tm_mon;
@ -594,19 +705,20 @@ 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)) {
if (WIFEXITED(status))
{
;
//printf("child process return %d\n", WEXITSTATUS(status));
}
@ -617,11 +729,12 @@ goto_daemon:
}
rule(conf);
sleep(conf->TIME);
}
} else {
}
else
{
rule(conf);
}
@ -630,5 +743,14 @@ goto_daemon:
free(conf);
free(public_ip);
for(int i=1; i<head_argc; i++)
{
//printf("%s %d\n", head_argvs[i], i);
if (head_argvs[i])
free(head_argvs[i]);
}
return 0;
}

View File

@ -10,7 +10,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关闭)

16
rhost.h
View File

@ -18,7 +18,8 @@
#include <assert.h>
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);

BIN
rhost.o Normal file

Binary file not shown.