From 36e8ead932a3f33b7c6aa4c0674d6ff064971a07 Mon Sep 17 00:00:00 2001 From: Giulio Date: Thu, 8 Nov 2018 22:24:53 +0100 Subject: [PATCH] Cemnsys API limit bypass --- acasown.py | 6 ++--- bong/__init__.pyc | Bin 1036 -> 603 bytes censys/__init__.py | 57 +++++++++++++++++++++++++++++++++++++++++++- censys/__init__.pyc | Bin 0 -> 4780 bytes ripe/__init__.pyc | Bin 0 -> 1674 bytes 5 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 censys/__init__.pyc create mode 100644 ripe/__init__.pyc diff --git a/acasown.py b/acasown.py index f10bcde..60d64c0 100644 --- a/acasown.py +++ b/acasown.py @@ -3,10 +3,10 @@ import censys import bong r = ripe.Ripe() -c = censys.Censys("dummy", "dummy") +c = censys.Censys_WEB("dummyuser", "dummypass") targets = r.search("trenitalia") print("Found " + str(len(targets)) + " ranges from Ripe") hosts = c.search_ipv4(c.build_query_ipv4(targets)) print("Found " + str(len(hosts)) + " hosts from Censys") -for i in hosts: - print(i) \ No newline at end of file +for host in hosts: + print(host) \ No newline at end of file diff --git a/bong/__init__.pyc b/bong/__init__.pyc index b05a3d35410509e095d52808bbabe0c953472c04..fc5a9265e46e2a177487780b19e9a0fdcd8352fc 100644 GIT binary patch delta 241 zcmXAhy$%6E6ov21$i{DhXoy5Pm2D&vO3^A%X(sFryUF_78QDgnQEFsf$a{DTI+c4V z&dIswe7U#$Gv|qSrC6HWJ#(o7fCgAF2m!7bI80}fVH=Qr=y!=_{pq9!WcZ#;c&Abjh}@g2O81(<&hX8~;F5C9ATW;6&X8AJiL zb8&*uf}O(r85|Q$46&xWP)MwZo`FSA$TX?90%VJN8)Mc1aY&N}tw6a+8$;`mRv{?v z0I1J`JIm^<@Lt+>vtt&1a}*KP-fO~jRTmkvGmXf+EJlBwb<;=V)*_IqhSDNN#i6HB_waUe{wGoy`oqvHSzNrcukK+r+ah7Mk z`dY@Ht8yHtsVg0)X?ONbxq6$``Hc|t;>dK(p~vsyifFhV%-V*g$jy=`Y^RJB0UxY&JA;AbSHD{)lcbK;PjI(vBS4!U+i{ zis)!nD$d5+j_r~oA(uRs644{C7A31F?mk)w1P1HvLj?W+j!esR%)V)xC&8X+1ltM7 z6w|cK3Y(@nt~4#G(PE0" + data = re.sub("\.*\<\/a\>", "", data)''' + self.parse_ipv4(data) + html = BeautifulSoup(data, "lxml") + spans = html.find_all('span', {'class': 'SearchResultSectionHeader__statistic'}) + pages = int(spans[0].text.split('/')[1].strip()) + count = spans[1].text + for page in range(2, pages + 1): + r = self.session.get(self.url + "ipv4/_search?q=", params={"q": query, "page": page}) + data = r.text + self.parse_ipv4(data) + return self.ipv4 + + def parse_ipv4(self, data): + html = BeautifulSoup(data, "lxml") + vhosts = [] + protocols = [] + results = html.find_all('div', {'class': 'SearchResult result'}) + for raw in results: + ip = raw.find_all('span', {'class': 'dns'})[0].get('id') + vhosts_html = raw.find_all('i', {'title': 'names on certificate'}) + if vhosts_html: + l = vhosts_html[0].next_sibling.replace(' ', '') + for vhost in l.split(','): + vhosts.append(vhost) + self.ipv4.append({'ip': ip, 'protocols': protocols, 'vhosts': vhosts}) return True \ No newline at end of file diff --git a/censys/__init__.pyc b/censys/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5ab086f680d8df5c85ab66547e89a630042e6374 GIT binary patch literal 4780 zcmcgwU2h~u6}>g%8PE7*Ke9{AECMDQSO$sgup1``X9J1Xkc~i2RE}igm1*^Mx9#?} zd&XTg-dV|hTAuk2Jn@8(fH(dC{11LWBqVqM3C_7Swijnn$SA_&E>~6Gx>a@Wx%ZxN z{jZC2|M>M^9wsvRspIcEc$`I(;@3zavK9I@DU2M{WUD4-@~$phbxH9%E9s2tH~4m0<&(mi$2yC1%P zb}&k>;&E@F$#5jY<6%P_2AbKyDQeom_I2%GQ$5sHQ|v~sft3j_$ft(qJ|1@$4HO)U zL?XwbgSMtK+V0nRE3=E&5Q1{SMYw+5eHrbZ_d~bR?>{yO0-}Uf>#@#}%zc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X80X(9j@^9!Mdk}v{Ays461Uq00c-4qj zPt;9-phf6T)`il z{VD?svTsee2vf$oU7-Q$Xwv-1F>gGNsBT~>_HE4Dx6UNX36N+_eD`Id%^lN?@{aDH z>^{#;=x3k%B2&SxCNAxM$KJv#`x+Z%4~iL##Jf+bfj{yeQfuEP0y%PMw`DE4~6HALDU1 z&@<6PeeclFuoTX|)@mGFQ*96-qy|x7y{A pTMjW#=T@1eIV=@Cw*n(^^xfz9kHx*f)_y>Jj`w7(T&P{U{clDyR4f1h literal 0 HcmV?d00001 diff --git a/ripe/__init__.pyc b/ripe/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..85bbdde5b964a261597ecdb93f15bfa6e4e2027b GIT binary patch literal 1674 zcmbVMPjBN?5T6$(-L~5^}7oHJ!!N&Q*JvcTHe1YXZ1aWW)HzW>P zV_^buEKHZ;^H4I$#7b5N>q{)Z4>BQI6D69{c__ytrMv~UPRoh&?Y=7(t{8`SlM;Ub zE}B+z7fqtCbB@w1_0@G5)yOqUlDy10Nlq3wybZ&ZqdL#p}}pJRtcebcAM5p z?*ck|^9|kh{uN_~`rM;+PdxPP?%N}_QSRePtmXG~A;GsWt*1zQ|I)C(+KT#8GklTGsi=&8+SOa>Uqk; z)x0>I7OiMG4E+(}ygYh6Iy(xhs~K#L`DWoxbA&0I`O8DkY0blr4zGDQ^Hs^x->FNj ztG#~?9=R2HmU3Q|kt)a#UT2wGa65PBn}T(0@b^{Kls4amivIxQzXN-j_kHkCf~%|A zEgMwrIe=v1SaGf41rv+3_6}p%piY%M*Ren{l>A~ri>8O_#9U5lbz)Oa)s!nv3q8mm zgHs99&O$2CR*^X{duHD}GXwLn>9?4byCAxX+26pdeigI=vjYHjaQ5aG0!UXs2~L6D z0k8|?mpvK+;dblb5iYv*9AOa*AQkL81)yE2_SMa>3M+T0)0qH)^X;~a{l zLWLTxC$=(HSK3gzqhr%y0c#Mpx(cR)6I8Cic1m}Kqtw(vQ2?)EZN8J3K0kY1Xk{Uf9hh`k~F|etGCQfu(R9x iQvcf!YF~?LGRez{sy{ZCmh(wlz^5_+FM;>WUgvLnYF1wW literal 0 HcmV?d00001