Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
a8adac3
Merge pull request #1 from bighomeman/master
sh9369 May 5, 2018
7c9a7c5
fix 4
sh9369 May 5, 2018
918c821
fix output
sh9369 May 7, 2018
919de75
add log
sh9369 May 9, 2018
cab1e2e
fix log
sh9369 May 9, 2018
673690d
fix log2
sh9369 May 9, 2018
549accd
fix alert
sh9369 May 9, 2018
38cc305
fix insert
sh9369 May 9, 2018
55bfff0
fix log
sh9369 May 9, 2018
3acd762
fix log
sh9369 May 9, 2018
d3c2a32
FIX
sh9369 May 9, 2018
a88a0b1
fix desc_type
sh9369 May 9, 2018
97f302d
fix output
sh9369 May 9, 2018
f1ad80b
fix segment match
sh9369 May 9, 2018
a7876aa
fix log
sh9369 May 9, 2018
6d79a45
fix readfile
sh9369 May 10, 2018
15e9737
add compare
sh9369 May 10, 2018
8cb41cb
fix save json
sh9369 May 10, 2018
1388caf
fix save json
sh9369 May 10, 2018
7e88f26
fix save json
sh9369 May 10, 2018
ac80c74
fix lpm
sh9369 May 10, 2018
a047d4d
fix
sh9369 May 10, 2018
b882289
fix output
sh9369 May 11, 2018
63ae6e6
fix update and check
sh9369 May 11, 2018
fe48c93
add debug log
sh9369 May 11, 2018
abeb7b7
delete dubug log
sh9369 May 11, 2018
f447416
add log info
sh9369 May 11, 2018
ae07f9e
add log info
sh9369 May 11, 2018
fe3a484
fix log
sh9369 May 14, 2018
53cda7b
fix log
sh9369 May 11, 2018
1555f00
add local blacklist and whitelist
sh9369 May 16, 2018
992ce34
fix dport type
sh9369 May 16, 2018
8af50fd
modified config
sh9369 May 16, 2018
77f84e0
fix encode
sh9369 May 16, 2018
79dded5
fix dport
sh9369 May 16, 2018
0928c1d
add default file path
sh9369 May 16, 2018
cebc98a
run
sh9369 May 16, 2018
8aac819
run
sh9369 May 16, 2018
534e694
run
sh9369 May 16, 2018
5cc1628
run
sh9369 May 16, 2018
50bcf47
run
sh9369 May 16, 2018
db91750
run blacklist and whitelist
sh9369 May 17, 2018
530573f
modified whitelist
sh9369 May 17, 2018
6b6a4f1
fix local blacklist
sh9369 May 17, 2018
cc53bd9
fix timestamp
sh9369 May 17, 2018
45a6e0b
fix time_zone
sh9369 May 18, 2018
dde8ab2
fix get blacklist
sh9369 May 21, 2018
4c3b468
add log function
sh9369 May 31, 2018
e027836
times
sh9369 May 31, 2018
84bf55d
run
sh9369 May 31, 2018
a229de7
run
sh9369 May 31, 2018
67c9fe0
run
sh9369 May 31, 2018
9872b50
run
sh9369 May 31, 2018
f3cb822
run
sh9369 May 31, 2018
c1a1885
run
sh9369 May 31, 2018
90e54f1
run
sh9369 May 31, 2018
6390b65
run
sh9369 May 31, 2018
0121871
run
sh9369 May 31, 2018
29bc874
run
sh9369 May 31, 2018
e51931c
run
sh9369 May 31, 2018
3d29493
run
sh9369 May 31, 2018
e91c145
run
sh9369 May 31, 2018
6a18a0a
run
sh9369 May 31, 2018
cf31181
run
sh9369 May 31, 2018
19e9188
run
sh9369 May 31, 2018
83143d9
run
sh9369 May 31, 2018
3303481
run
sh9369 May 31, 2018
386e319
run
sh9369 May 31, 2018
bdd4a28
run
sh9369 May 31, 2018
92b2867
run
sh9369 May 31, 2018
927f639
run
sh9369 May 31, 2018
bae7ec8
run
sh9369 May 31, 2018
374170b
fix download
sh9369 Jun 1, 2018
789978c
run
sh9369 Jun 1, 2018
99be670
add function
sh9369 Jun 1, 2018
878693a
modified query string
sh9369 Jun 1, 2018
d3ef0d3
fix function
sh9369 Jun 1, 2018
6a8d581
fix function
sh9369 Jun 1, 2018
a0b9aa6
fix function
sh9369 Jun 1, 2018
e9a1661
fix function
sh9369 Jun 1, 2018
d8ea8f9
add log info
sh9369 Jun 1, 2018
498a8e6
fix function
sh9369 Jun 1, 2018
0f616fa
modified C2 function
sh9369 Jun 1, 2018
aeaeb9b
fix second check
sh9369 Jun 1, 2018
d2cbde2
fix bitnodes function
sh9369 Jun 4, 2018
faf349a
add default data
sh9369 Jun 4, 2018
3422980
fix bitnodes
sh9369 Jun 4, 2018
27dad12
fix second check
sh9369 Jun 4, 2018
f25780e
fix second check
sh9369 Jun 4, 2018
5d45e65
fix time
sh9369 Jun 4, 2018
bcd9884
fix check C2
sh9369 Jun 4, 2018
7ac9796
fix blacklist
sh9369 Jun 5, 2018
f3f85e2
add logs
sh9369 Jun 7, 2018
1636281
cancel spam
sh9369 Jun 8, 2018
0b3c9ed
modified download function
sh9369 Jun 8, 2018
e2f7b3c
add logs
sh9369 Jun 11, 2018
33a2852
adds timeout
sh9369 Jun 11, 2018
b43fb5d
fix bitnodes
sh9369 Jun 11, 2018
e3f9ddc
add timeout check
sh9369 Jun 12, 2018
919712c
modified query notes
sh9369 Jun 14, 2018
5a6d58b
fix add
sh9369 Jun 25, 2018
0215afa
modified description
sh9369 Jun 27, 2018
c214f78
fix
sh9369 Jun 27, 2018
2985056
fix
sh9369 Jun 27, 2018
5169aaf
fix
sh9369 Jun 27, 2018
db81808
fix
sh9369 Jun 27, 2018
633903c
fix
sh9369 Jun 27, 2018
c28cbb4
fix abuse
sh9369 Jun 27, 2018
64568ed
add data source
sh9369 Jun 28, 2018
47f74c8
add droplist
sh9369 Jun 28, 2018
f4f6a82
modified IP subnet match
sh9369 Jun 29, 2018
934c514
fix log
sh9369 Jun 29, 2018
9bfc665
fix search query
sh9369 Jun 29, 2018
cc2385b
fix local bl
sh9369 Jun 29, 2018
01ca61f
add query
sh9369 Jul 3, 2018
82ab1a1
fix
sh9369 Jul 16, 2018
d4495c6
fix download function
sh9369 Jul 17, 2018
46b95e5
new readme
sh9369 Jul 17, 2018
145e5fd
add Comments
sh9369 Jul 18, 2018
7d291f1
modified alert info
sh9369 Jul 20, 2018
6a5a7c2
fix second check
sh9369 Aug 2, 2018
11238b3
fix second check
sh9369 Aug 2, 2018
4d68d6c
fix second check
sh9369 Aug 2, 2018
d96fdb2
fix second check ip
sh9369 Aug 2, 2018
a579d14
add whitelist
sh9369 Aug 3, 2018
5ca76f3
add local bl
sh9369 Aug 5, 2018
4c16370
add check_XForce
sh9369 Aug 15, 2018
1dab6fb
fix readme
sh9369 Aug 15, 2018
6eaaf4b
fix
sh9369 Aug 15, 2018
261b861
fix 2
sh9369 Aug 15, 2018
0200518
fix readme
sh9369 Aug 15, 2018
8ae8b9c
fix readme
sh9369 Aug 15, 2018
30ff0a6
fix READme
sh9369 Aug 15, 2018
1d6ee10
fix README
sh9369 Aug 15, 2018
db37c50
fix
sh9369 Aug 15, 2018
f0bfe56
fix
sh9369 Aug 15, 2018
a66459e
fix readme
sh9369 Aug 15, 2018
a6ec319
fix readme
sh9369 Aug 15, 2018
d1ae4e1
fix readme
sh9369 Aug 15, 2018
9608a5c
fix readme
sh9369 Aug 15, 2018
58b41bb
fix READme
sh9369 Aug 15, 2018
72c0066
fix check_XForce
sh9369 Aug 15, 2018
399eb6a
fix blacklist
sh9369 Aug 24, 2018
4d05146
fix blacklist
sh9369 Aug 24, 2018
0d3918e
fix codes
sh9369 Sep 1, 2018
9026939
fix xforce
sh9369 Sep 7, 2018
54b1459
fix score
sh9369 Sep 20, 2018
43eb0e8
fix xforce
sh9369 Sep 20, 2018
96ebcdf
add xforce data
sh9369 Sep 20, 2018
5882fa9
change index
sh9369 Oct 12, 2018
e088c66
fix index
sh9369 Oct 12, 2018
c6cf0d6
fix check c2
sh9369 Oct 15, 2018
3eb0e12
update xf
sh9369 Nov 21, 2018
80acc38
update
sh9369 Dec 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/personal_respo2.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

713 changes: 713 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

146 changes: 117 additions & 29 deletions READme.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,127 @@
# personal_respo2
# ǰ��<br>
���������ڻ�ȡ�����鱨�����imap�м�¼��Ŀ��ip��ַ���м�飬��Ŀ��ip���鱨�г��ֵ�ipƥ�䣬�򷢳��澯��Ϣ�������澯��Ϣд��ES�С�<br>

This is a monitor for checking your host access c&c host by dns request.
����������Linux���������У�����python 2.7�﷨�淶��д����Ҫ��������������£�
json��logging��datetime��time��elasticsearch��ConfigParser��socket��struct��re��requests��bs4��lxml
<br>
������GitHub��ַΪ��https://github.com/sh9369/personal_respo2
<br>
## ����
1. GitHub��ҳ��ʹ��zip������ص�personal_respo2-master.zip����ѹ���personal_respo2�ļ��У���ʹ��git clone ����ֱ�����ء���Ҫ���ļ�Ŀ¼��ʽ���£�
```
personal_respo2:
|����project�� �������ļ�Ŀ¼
|����data: �������ݴ��Ŀ¼
|����log�� ��־�ļ�Ŀ¼
|����self_blacklist�� ���غ������ļ�Ŀ¼
|����self_defaultlist�� ����Ĭ���鱨ԴĿ¼
|����self_whitelist�� ���ذ������ļ�Ŀ¼
|����get_blacklist�� �����鱨Դ�����ļ����Ŀ¼
|����MiningServerIPList.py�� ���崦�������鱨���ļ�
|���� ......
|����lpm: lpm�㷨����Ŀ¼
|����blacklist_match.conf�� ���������ļ�
|����blacklist_tools.py�� ���򹫹����������ļ�
|����update_blacklist.py�� ���º������ļ�
|����match_insert.py�� ƥ���Լ�����ES�����ļ�
|����ontime_run.py�� �������
|����parser_config.py�� �����ļ����������ļ�
|����subnet_range.py�� IP�����δ��������ļ�
|����treat_ip.py�� IP�������������ļ�
|����ip_check_C2.py�� ���μ�鴦���ļ�
|����check_XForce.py�� ��ȡxforce��Ϣ�ļ�
```
## ����
2.����ǰ����blacklist_match.conf�ļ��������ò������޸ģ�
<br>2.1 �޸�[frequency]�µ�starttime����ʾ��ʼ���ʱ�䣻
<br>2.2 �޸�[ES_info]�¶�Ӧ��server/dport��Ϣ��
<br>2.3 �����������غ�����������[self_blacklist_path]����blacklist_flg=1��path��Ӧ�ڱ��غ�������Ĭ��Ŀ¼��
��������Ĭ���鱨Դ�����������������һ�¡�
<br>2.4 ����������£�������[update_flg]��updateFlg=0���Ա�رո��¹��ܡ�
<br>
<br>3.��װ��ɶ�Ӧpython�汾�Լ��������󣬽���/projectĿ¼��ʹ������������������
<br>nohup python ontime_run.py &
<br>���ٴλس���
<br>ʹ����������鿴��־�ļ���
<br>tail -50f ./data/log/testlog
<br>��־�ļ����¼���������е������Ϣ����������־�ļ�����д�����ݺ��ʾ�����Ѿ����С�
<br>
<br>
## �����鱨Դ
4.���������鱨Դ�ķ���
<br>4.1 ��/get_blacklistĿ¼���½�һ�������ļ�������ΪXXX.py��
<br>
4.2 ��XXX.py�б�д�������鱨����/��ϴ/�洢���̣���ر�֤���մ洢�����ݸ�ʽ���£�

The dns-blacklist are collected from open Information web site against malware.
`{

About get_blacklist profile #you can extend data from other's Information web. Writing parsing data py-script into this profile. #Then enhancing the checking scale of monitor.
"ip1":

(1)please keep a funtion 'return dict' like this: the format like:
{ #������������ο����������ļ�

{ 'tcp or dns ip':
��subtype������mining_pool��

{

'type':malware type

'date':add date 'source':information web

'status':online or offline

'false_positive':'unknown' or 'low' or 'high' #misreporting rate for source web

'level':'WARNING'or 'critical' #decide it by youself

},

'...':

{
.... #other dict date
},

} #you can find example in project/get_blacklist profile
��desc_subtype������... ... "

(2) add new file in blacklist_match.conf. sperate by ',' do not add ',' in the end.
... ....

#example : fun1 = ransomwaretracker , malwaredomainlist , zeustracker , malwaredomains keep python file name consisting with configue name.
}��

(3) 'from save_json.py import save_json' function write json file. you can find it at example file's end
"ip2":

{

... ...

}��

... ...

}`
<br>4.3 ȷ�������鱨����Դ�ĸ���Ƶ�ʣ���blacklist_match.conf�ļ���[parse_blacklist]�µ�fun1ĩβ���ӡ�,XXX:frequency"
<br>
<br>
## XForce��Ϣ
5.��ȡXForce ��Ϣ��
<br>5.1 ��Ҫ�ļ��� check_XForce.py
<br>
5.2 ���÷�����<br>
```
import check_XForce as xf
xf.start(1,lists)
```
#start(stype,values,checkflg=1)�������;<br>
#params: <br>
stypeȡֵΪ1��2��1��ʾ���Ķ���values��IP�б���2��ʾvalues��url�б���<br>
values��ʾ�����IP��url���б���<br>
checkflgĬ��ֵΪ1����ʾд���ļ�������ֵΪ0�����ʾ��д���ļ���<br>
#return:<br>
final_dic ���ֵ���ʽ���أ���ѯ������Ϊkey����������ֵΪvalue<br>
#example for return��
```
{
"198.54.117.200": {
"company": "NAMECHEAP-NET - Namecheap, Inc., US",
"cats": {
"Botnet Command and Control Server": 43,
"Malware": 43,
"Anonymisation Services": 43
},
"geo": "United States",
"score": 4.3,
"asns": "22612"
},
"197.210.23.55": {
"cats": {
"Dynamic IPs": 71
},
"company": "VCG-AS, NG",
"score": 1,
"geo": "Nigeria",
"asns": "29465"
}
}
```
<br>5.3 ��������Լ�ע����������ļ�check_XForce.py
<br>
4 changes: 4 additions & 0 deletions project/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions project/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions project/.idea/project.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading