Skip to content

Commit

Permalink
trying to fix ftp crawler, changes 2 the urlschema, changed meteo,
Browse files Browse the repository at this point in the history
  • Loading branch information
cl4u2 committed May 21, 2011
1 parent 0bd3f5a commit c61eb6e
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 18 deletions.
2 changes: 1 addition & 1 deletion browse_share.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pre_html = '''
<li><a href="/cgi-bin/browse_share.cgi">Files</a></li>
<li><a href="/cgi-bin/proxy_wiki.cgi?url=Elenco_Telefonico_rete_VoIP_di_ninux.org">VoIP</a></li>
<li><a href="http://10.162.0.85/">WebMail</a></li>
<li><a href="">Meteo</a></li>
<li><a href="http://10.168.43.127/meteo/">Meteo</a></li>
</ul>
</div>
<div class="logo">
Expand Down
6 changes: 6 additions & 0 deletions dbmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def addRes(self, resource):
self.__reslock.notify()
self.__reslock.release()

class FakeSilos():
def getRes(self):
print "getRes"
def addRes(self, resource):
print resource

class ResourceStorer(MysqlConnectionManager, threading.Thread):
def __init__(self, dbhost, dbuser, dbpassword, database, silos):
MysqlConnectionManager.__init__(self, dbhost, dbuser, dbpassword, database)
Expand Down
16 changes: 10 additions & 6 deletions ftpdrone.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def dance(self, ftpurl, depth=0):
if depth > 10: #maximum recursion depth
return

m = re.search(".*://[^/]*(.*)", ftpurl)
m = re.search(".*://[^/]*(/.*)", ftpurl)
if m and len(m.group(1)) > 0: # the rest of the uri
currentdir = m.group(1)
else:
Expand All @@ -51,10 +51,10 @@ def dance(self, ftpurl, depth=0):
r = Resource()
r.uri = ftpurl
r.server = self.target
try:
self.silos.addRes(r)
except:
self.dance(ftpurl + "/" + e.name, depth+1)
# try:
# self.silos.addRes(r)
# except:
self.dance(ftpurl + "/" + e.name, depth+1)
else:
r = Resource()
r.uri = ftpurl + "/" + e.name
Expand All @@ -81,7 +81,11 @@ def run(self):
print "results for %s gathered" % self.target
except:
print "%s error" % self.target
raise

if __name__ == "__main__":
s = FtpDancer("10.168.177.179", None)
fsilos = FakeSilos()
s = FtpDancer("10.168.177.179", fsilos)
# s = FtpDancer("217.133.178.217", fsilos)
s.run()

28 changes: 18 additions & 10 deletions ninuxoo.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@ useragent = os.environ.get("HTTP_USER_AGENT", "unknown").upper()
try:
schoice = fs['s'].value
except:
if useragent.find('WIN') != -1:
schoice = "file"
elif useragent.find('SAFARI') != -1:
schoice = "smb"
elif useragent.find('KONQUEROR') != -1:
schoice = "smb"
else:
schoice = "file"
schoice = "verbose"

# if useragent.find('EXPLORER') != -1:
# schoice = "file"
# elif useragent.find('SAFARI') != -1:
# schoice = "smb"
# elif useragent.find('MOZILLA') != -1:
# schoice = "smb"
# elif useragent.find('KONQUEROR') != -1:
# schoice = "smb"
# else:
# schoice = "file"


outputhead = """
Expand Down Expand Up @@ -161,8 +165,12 @@ for i in range(len(resp.resultlist)):
print "<a name='res%d' class='restitle'>%s</a>" %(i, resp.labels[i])
print "<ul class='results'>"
for resource in rlist:
fileuri = resource.uri.replace("smb://", smbschema, 1)
print '<li class="result"><a href="%s">%s</a></li>' % (fileuri, fileuri)
if schoice == "verbose":
fileuri = resource.uri.replace("smb://", "//", 1)
print '<li class="result">su %s: %s</li>' % (resource.server, fileuri)
else:
fileuri = resource.uri.replace("smb://", smbschema, 1)
print '<li class="result"><a href="%s">%s</a></li>' % (fileuri, fileuri)
print "</ul>"
print "<div class='bottomtoplink'><span class='uarr'>&uarr;</span><a href='#rindex'>TOP</a></div>"

Expand Down
2 changes: 1 addition & 1 deletion proxy_wiki.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pre_html = '''
<li><a href="/cgi-bin/browse_share.cgi">Files</a></li>
<li><a href="/cgi-bin/proxy_wiki.cgi?url=Elenco_Telefonico_rete_VoIP_di_ninux.org">VoIP</a></li>
<li><a href="http://10.162.0.85/">WebMail</a></li>
<li><a href="">Meteo</a></li>
<li><a href="http://10.168.43.127/meteo/">Meteo</a></li>
</ul>
</div>
<div class="logo">
Expand Down
3 changes: 3 additions & 0 deletions resources.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python2

import re
import commands

class Resource():
uri = ""
Expand Down Expand Up @@ -76,6 +77,8 @@ class Query(Resource):
def __init__(self, query):
Resource.__init__(self)
self.uri = query
if self.uri.upper().startswith("FARMSAY"):
commands.getoutput("""echo '(SayText "%s")' | nc localhost 1314""" % self.uri[7:])

if __name__ == "__main__":
r = Resource(uri="smb://10.0.1.1/public.h/uuuu/ciao.ciao/bello.mp3", server="10.0.1.1")
Expand Down

0 comments on commit c61eb6e

Please sign in to comment.