-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathstatis-v1.0.py
131 lines (114 loc) · 3.26 KB
/
statis-v1.0.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/python
#
# RSS pubDate Scraper
v = "Version: 1.0"
# Changelog:
# 1.0 - First stable version
#
# Python 2.7.3
# Tested on Kali Linux
# Developer: Hans-Michael Varbaek
# URLs:
# https://defense.ballastsecurity.net/decoding/rss/pbot.rss
# https://defense.ballastsecurity.net/decoding/rss/ra1nx.rss
#
# pip install feedparser
#
# Known bugs:
# - Some of the RSS feed items does not have all the necessary parameters.
#
# License: Attribution-ShareAlike 3.0 Unported
# http://creativecommons.org/licenses/by-sa/3.0/deed.en_US
# Generic Imports
import os
import sys
import time
# Used to read and parse the RSS feed
import feedparser
import base64
# Global RSS Variables
global pbotrss
global rainxrss
pbotrss = "https://defense.ballastsecurity.net/decoding/rss/pbot.rss"
rainxrss = "https://defense.ballastsecurity.net/decoding/rss/ra1nx.rss"
# Global Directory Variables
global output
output = "statisDir"
# Functions
def checkOS():
if(os.name) == "posix":
os.system("clear")
elif(os.name) == "nt":
os.system("cls")
print "\n[!] This tool was created to run under Linux."
sys.exit(1)
else:
print "\n[!] This tool was created to run under Linux."
sys.exit(1)
def checkDir(directory):
if not os.path.exists(directory):
os.makedirs(directory)
def printBanner():
var = """ _____________________________
/ RSS pubDate Scraper \\
|-----------------------------|
| Developed by: Capt. Obvious |
| %s | aka. Varbaek |
\\-----------------------------/
""" % v
print var
def getpBot():
i = 0
print "[*] Connecting to pBot RSS.."
try:
feed = feedparser.parse( pbotrss )
except:
print "[!] An error occurred connecting to: %s" % pbotrss
return
print "[*] Title: "+feed[ "channel" ][ "title" ] # Bot RSS Feed
print "[*] Description: "+feed[ "channel" ][ "description" ] # Links to new decoded pBot payloads.
print "[*] Link: "+feed[ "channel" ][ "link" ] # https://defense.ballastsecurity.net/decoding/rss/pbot.rss
# Assign a new variable
list = feed[ "items" ]
for item in list:
writeme = item["published"]+"\r\n"
filename = output+"/statistics_pbot_"+time.strftime("%H-%M-%S-%Y")
fp = open(filename, 'a+')
fp.write(writeme)
fp.close()
i = i+1
def getRAINX():
i = 0
print "[*] Connecting to RA1NX RSS.."
try:
feed = feedparser.parse( rainxrss )
except:
print "[!] An error occurred connecting to: %s" % rainxrss
return
print "[*] Title: "+feed[ "channel" ][ "title" ] # Bot RSS Feed
print "[*] Description: "+feed[ "channel" ][ "description" ] # Links to new decoded RA1NX payloads.
print "[*] Link: "+feed[ "channel" ][ "link" ] # https://defense.ballastsecurity.net/decoding/rss/ra1nx.rss
# Assign a new variable
list = feed[ "items" ]
for item in list:
writeme = item["published"]+"\r\n"
filename = output+"/statistics_ra1nx_"+time.strftime("%H-%M-%S-%Y")
fp = open(filename, 'a+')
fp.write(writeme)
fp.close()
i = i+1
# /************************\
# | MAIN FUNCTION MODULE |
# \************************/
def main():
try:
checkDir(output)
checkOS()
printBanner()
getpBot()
getRAINX()
except KeyboardInterrupt:
print '\n[*] CTRL+C detected, shutting down.'
sys.exit(1)
if __name__ == "__main__":
main()