Skip to content

Commit a545335

Browse files
authored
Add files via upload
1 parent 7e0556a commit a545335

6 files changed

Lines changed: 271 additions & 0 deletions

File tree

‎twitter抓取/README.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
### twitter抓取 ###
2+
- [x] 获取指定用户名发的推文
3+
- [x] 保存到txt
4+
- [x] 支持时间过滤
5+
- [x] 支持用户配置
6+
7+
8+
### config.py说明 ###
9+
```python
10+
user_path='conf/user.txt' #存放着要抓的用户名的txt
11+
proxy = '127.0.0.1:1080' #代理设置
12+
proxies = {
13+
'http': 'http://' + proxy,
14+
'https': 'https://' + proxy
15+
}
16+
cookie='' #你的cookie
17+
times='' #时间过滤,如果不想设置请留空,times=''
18+
```
19+
20+
user.txt示例:
21+
```python
22+
demonsec666
23+
AmarSaar
24+
WBGlIl
25+
KitPloit
26+
evilcos
27+
HackwithGithub
28+
```
29+
30+
### 截图 ###
31+
程序运行图:
32+
![](https://s2.ax1x.com/2019/06/29/ZQE8P0.png)
33+
34+
save.txt图:
35+
![](https://s2.ax1x.com/2019/06/29/ZQEYxU.md.png)
1.25 KB
Binary file not shown.

‎twitter抓取/conf/config.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
user_path='conf/user.txt' #存放着要抓的用户名的txt
2+
proxy = '127.0.0.1:1080' #代理设置
3+
proxies = {
4+
'http': 'http://' + proxy,
5+
'https': 'https://' + proxy
6+
}
7+
cookie='' #你的cookie
8+
times='' #时间过滤,如果不想设置请留空,times=''

‎twitter抓取/conf/user.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
demonsec666
2+
AmarSaar
3+
WBGlIl
4+
KitPloit
5+
evilcos
6+
HackwithGithub

‎twitter抓取/save.txt‎

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
用户名:HackwithGithub 推特url:https://twitter.com/HackwithGithub/status/977037846988046336 时间:
2+
下午9:22 - 2018年3月22日
3+
4+
Don't miss out @faradaysec demo at Arsenal station 5
5+
6+
https://github.com/infobyte/faraday …pic.twitter.com/kP0SJYgyCL
7+
Thanks for the cool demo
8+
用户名:demonsec666 推特url:https://twitter.com/demonsec666/status/1137545655730098176 时间:
9+
下午7:23 - 2019年6月8日
10+
11+
I've just found a simple method for COM hijacking, It works by changing registry structures for CLSID and/or Progid, and then It gives ability to Invoke COM instructions.
12+
PoC/
13+
https://gist.github.com/homjxi0e/7894be4695e5f348a749ce5ec31bd314 …pic.twitter.com/JNvgTBn2sb
14+
cscript C:\Windows\System32\Printing_Admin_Scripts\zh-CN\prncnfg.vbs /?
15+
16+
pic.twitter.com/JQV86RTrmZ
17+
用户名:demonsec666 推特url:https://twitter.com/demonsec666/status/1134637701729214464 时间:
18+
下午6:48 - 2019年5月31日
19+
20+
用户名:HackwithGithub 推特url:https://twitter.com/HackwithGithub/status/977035936151162880 时间:
21+
下午9:14 - 2018年3月22日
22+
23+
https://youtu.be/xKRDo6Q6r3Y 
24+
https://www.ggsec.cn/comhijack&meterpreter.html …
25+
comhijack&meterpreterpic.twitter.com/eDs86w8G6z
26+
https://gist.github.com/demonsec666/e897c2dbf06a6f3d8e9f131d155426ad …
27+
Good article. Thank you for sharing 谢谢!
28+
29+
30+
Automated Penetration Toolkit demonstration at #BlackHatArsenal
31+
https://github.com/MooseDojo/apt2 pic.twitter.com/ZPHpwqQtNj
32+
用户名:HackwithGithub 推特url:https://twitter.com/HackwithGithub/status/977035936151162880 时间:
33+
下午9:14 - 2018年3月22日
34+
35+
Automated Penetration Toolkit demonstration at #BlackHatArsenal
36+
https://github.com/MooseDojo/apt2 pic.twitter.com/ZPHpwqQtNj
37+
用户名:demonsec666 推特url:https://twitter.com/demonsec666/status/1115890630767652864 时间:
38+
上午1:13 - 2019年4月10日
39+
40+
pic.twitter.com/iKQSjQG3HT
41+
Nicely made in Powershell
42+
Expanded on this just a little bithttps://pastebin.com/jXaz8xMx 
43+
44+
用户名:demonsec666 推特url:https://twitter.com/demonsec666/status/1070698412402606086 时间:
45+
上午7:16 - 2018年12月6日
46+
47+
https://github.com/demonsec666/SecistSploit …
48+
https://www.youtube.com/watch?v=6ddv5r-IMFw …pic.twitter.com/j3f5WTYa0R
49+
用户名:HackwithGithub 推特url:https://twitter.com/HackwithGithub/status/977035936151162880 时间:
50+
下午9:14 - 2018年3月22日
51+
52+
Automated Penetration Toolkit demonstration at #BlackHatArsenal
53+
https://github.com/MooseDojo/apt2 pic.twitter.com/ZPHpwqQtNj
54+
用户名:demonsec666 推特url:https://twitter.com/demonsec666/status/1070698412402606086 时间:
55+
上午7:16 - 2018年12月6日
56+
57+
https://github.com/demonsec666/SecistSploit …
58+
https://www.youtube.com/watch?v=6ddv5r-IMFw …pic.twitter.com/j3f5WTYa0R
59+
用户名:HackwithGithub 推特url:https://twitter.com/HackwithGithub/status/976693407404863489 时间:
60+
下午10:33 - 2018年3月21日
61+
62+
@ArcherySec by @anandtiwarics at #BlackHatArsenal Station 6pic.twitter.com/Nv7b1ehZ5J
63+
用户名:demonsec666 推特url:https://twitter.com/demonsec666/status/1061054447147606016 时间:
64+
下午4:34 - 2018年11月9日
65+
66+
Tenable Researcher @CE2Wells discusses a new technique for bypassing Microsoft's User Account Control through mocking trusted directories. Read more in the Tenable Tech Blog: http://bit.ly/2Dcbc83  #TenableResearch #CyberExposure #UAC #useraccountcontrol
67+
pic.twitter.com/24wKCXgEWj
68+
youll need to export the same function names that winSAT expects to import. You can just make them empty stubs
69+
thx
70+
用户名:HackwithGithub 推特url:https://twitter.com/HackwithGithub/status/976691561156116480 时间:
71+
下午10:26 - 2018年3月21日
72+
73+
NetRipper by @NytroRSTpic.twitter.com/pmJFD3cnnw
74+
用户名:demonsec666 推特url:https://twitter.com/demonsec666/status/1059267730627420160 时间:
75+
下午6:14 - 2018年11月4日
76+
77+
CVE-2018-4280: Mach port replacement vulnerability in launchd on macOS 10.13.5 leading to local privilege escalation and SIP bypass.https://github.com/bazad/launchd-portrep …
78+
MAC OSX 10.12.6pic.twitter.com/ZWl6QuJp3Q
79+
MAC OSX 10.14.1pic.twitter.com/hP2ZHyUIp5
80+
Vuln has been patched in 10.14
81+
用户名:HackwithGithub 推特url:https://twitter.com/HackwithGithub/status/976678861449568256 时间:
82+
下午9:36 - 2018年3月21日
83+
84+
@objective_see at #BlackHatArsenal Station 2pic.twitter.com/uRhc793q8L
85+
#DoNotDisturb coming soon !pic.twitter.com/FopYO65pDu
86+
用户名:demonsec666 推特url:https://twitter.com/demonsec666/status/1059266955545178112 时间:
87+
下午6:11 - 2018年11月4日
88+
89+
CVE-2018-4280: Mach port replacement vulnerability in launchd on macOS 10.13.5 leading to local privilege escalation and SIP bypass.https://github.com/bazad/launchd-portrep …
90+
MAC OSX 10.12.6pic.twitter.com/ZWl6QuJp3Q
91+
MAC OSX 10.14.1pic.twitter.com/hP2ZHyUIp5
92+
用户名:HackwithGithub 推特url:https://twitter.com/HackwithGithub/status/976672986269868033 时间:
93+
下午9:12 - 2018年3月21日
94+
95+
@objective_see at #BlackHatArsenal Station 2pic.twitter.com/uRhc793q8L
96+
#DoNotDisturb coming soon !pic.twitter.com/FopYO65pDu
97+
用户名:demonsec666 推特url:https://twitter.com/demonsec666/status/1058540162295025666 时间:
98+
下午7:03 - 2018年11月2日
99+
100+
http://www.ggsec.cn/bypass-UAC-Adduser.html …pic.twitter.com/V1Z5yDH8cL
101+
用户名:HackwithGithub 推特url:https://twitter.com/HackwithGithub/status/976672986269868033 时间:
102+
下午9:12 - 2018年3月21日
103+
104+
@objective_see at #BlackHatArsenal Station 2pic.twitter.com/uRhc793q8L
105+
#DoNotDisturb coming soon !pic.twitter.com/FopYO65pDu
106+
用户名:demonsec666 推特url:https://twitter.com/demonsec666/status/1053105421282496512 时间:
107+
下午7:07 - 2018年10月18日
108+
109+
http://www.ggsec.cn/rid-hijack.html pic.twitter.com/Gkhar9Msaj
110+
sixsixsix
111+
用户名:HackwithGithub 推特url:https://twitter.com/HackwithGithub/status/976671179485323264 时间:
112+
下午9:05 - 2018年3月21日
113+
114+
Arsenal Schedulepic.twitter.com/lNKguE2NzK

‎twitter抓取/zhua.py‎

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#@author:九世
2+
#@time:2019/6/28
3+
#@file:zhua.py
4+
5+
import requests
6+
import re
7+
import conf.config
8+
import gevent
9+
import os
10+
from multiprocessing import Process
11+
from bs4 import BeautifulSoup
12+
13+
tw_name=[]
14+
tw_id=[]
15+
16+
class Zhua():
17+
def reads(self):
18+
if os.path.exists(conf.config.user_path):
19+
dk=open(conf.config.user_path,'r',encoding='utf-8')
20+
for d in dk.readlines():
21+
qc="".join(d.split('\n'))
22+
tw_name.append(qc)
23+
else:
24+
print('[-] 找不到文件')
25+
exit()
26+
27+
print('[+] 要爬的用户名')
28+
print(tw_name)
29+
30+
def reqt(self,username):
31+
global proxies,headers,cookies
32+
proxies=conf.config.proxies
33+
headers={
34+
'accept':'application/json, text/javascript, */*; q=0.01',
35+
'accept-encoding':'gzip, deflate, sdch, br',
36+
'accept-language':'zh-CN,zh;q=0.8',
37+
'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0',
38+
'referer':'https://twitter.com/{}'.format(username),
39+
'x-requested-with':'XMLHttpRequest',
40+
'x-twitter-active-user':'yes'
41+
}
42+
cookies={}
43+
cookie=conf.config.cookie
44+
for c in cookie.split(';'):
45+
key,value=c.split('=',1)
46+
cookies[key]=value
47+
url='https://twitter.com/i/profiles/show/{}/media_timeline?for_photo_rail=true'.format(username)
48+
rqt=requests.get(url=url,headers=headers,proxies=proxies,cookies=cookies)
49+
js=rqt.json()['items_html']
50+
data_status_id=re.findall('data-status-id=.*',str(js))
51+
for s in data_status_id:
52+
tw_id.append(str(s).replace('data-status-id=','').replace('"',''))
53+
54+
def djc(self):
55+
rw=[]
56+
calc=0
57+
for l in tw_id:
58+
if len(rw)==100:
59+
p=Process(target=self.xc,args=(rw,cookies,headers))
60+
p.start()
61+
calc=0
62+
rw.clear()
63+
rw.append(l)
64+
calc+=1
65+
66+
if len(rw)>0:
67+
p = Process(target=self.xc, args=(rw,cookies,headers))
68+
p.start()
69+
70+
def xc(self,rc,cookies,headers):
71+
rw=[]
72+
for r in rc:
73+
rw.append(gevent.spawn(self.getrespone,r,cookies,headers))
74+
75+
print('[+] 抓取的内容')
76+
gevent.joinall(rw)
77+
78+
def getrespone(self,id,cookies,headers):
79+
url='https://twitter.com/KitPloit/status/{}?conversation_id={}'.format(id,id)
80+
rqts=requests.get(url=url,headers=headers,proxies=conf.config.proxies,cookies=cookies)
81+
bt=BeautifulSoup(rqts.text,'html.parser')
82+
nam=re.findall('[/].*[/]status',str(rqts.url))
83+
name=str(nam[0]).replace('//twitter.com/','').replace('/status','')
84+
times=bt.find_all('span',class_="metadata")[0].get_text()
85+
if conf.config.times!='':
86+
if conf.config.times in times:
87+
print('用户名:{} 推特url:{} 时间:{}'.format(name,rqts.url,times))
88+
print('用户名:{} 推特url:{} 时间:{}'.format(name, rqts.url, times),file=open('save.txt','a',encoding='utf-8'))
89+
print('内容:')
90+
for b in bt.find_all('p',class_="TweetTextSize"):
91+
print(b.get_text())
92+
print(b.get_text(),file=open('save.txt','a',encoding='utf-8'))
93+
print('')
94+
else:
95+
print('用户名:{} 推特url:{} 时间:{}'.format(name, rqts.url, times))
96+
print('用户名:{} 推特url:{} 时间:{}'.format(name, rqts.url, times), file=open('save.txt', 'a', encoding='utf-8'))
97+
print('内容:')
98+
for b in bt.find_all('p', class_="TweetTextSize"):
99+
print(b.get_text())
100+
print(b.get_text(), file=open('save.txt', 'a', encoding='utf-8'))
101+
print('')
102+
if __name__ == '__main__':
103+
obj=Zhua()
104+
obj.reads()
105+
for k in tw_name:
106+
obj.reqt(k)
107+
108+
obj.djc()

0 commit comments

Comments
 (0)