Permalink
Browse files

First commit

  • Loading branch information...
0 parents commit f4087dc4b45b309f7c72f395ee54c235558ff424 @nycholas committed Aug 28, 2011
Showing with 539 additions and 0 deletions.
  1. +9 −0 AUTHORS
  2. +13 −0 CONTRIBUTORS
  3. +26 −0 COPYING
  4. 0 ChangeLog
  5. 0 FAQ
  6. 0 INSTALL
  7. +40 −0 README.rst
  8. 0 THANKS
  9. 0 TODO
  10. +63 −0 leech_invaders.py
  11. +388 −0 setup.py
@@ -0,0 +1,9 @@
+# This is the official list of Leech Invaders authors for copyright purposes.
+# This file is distinct from the CONTRIBUTORS files.
+# See the latter for an explanation.
+
+# Names should be added to this file alphabetically as
+# Name or Organization <email address>
+# The email address is not required for organizations.
+
+Nycholas de Oliveira e Oliveira <nycholas@gmail.com>
@@ -0,0 +1,13 @@
+# This is the official list of people who can contribute
+# (and typically have contributed) code to the Leech Invaders repository.
+# The AUTHORS file lists the copyright holders; this file
+# lists people. For example, Cenobites employees are listed here
+# but not in AUTHORS, because Cenobites holds the copyright.
+#
+# The submission process automatically checks to make sure
+# that people submitting code are listed in this file (by email address).
+#
+# Names should be added to this file alphabetically like so:
+# Name <email address>
+
+Nycholas de Oliveira e Oliveira <nycholas@gmail.com>
26 COPYING
@@ -0,0 +1,26 @@
+Copyright (c) 2011, Nycholas de Oliveira e Oliveira <nycholas@gmail.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the Nycholas de Oliveira e Oliveira nor the names of
+ its contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
No changes.
0 FAQ
No changes.
No changes.
@@ -0,0 +1,40 @@
+Leech Invaders
+==============
+
+A notifier leech invaders internet.
+
+
+Referencies
+***********
+
+* http://en.wikipedia.org/wiki/Leech
+* http://www.voidspace.org.uk/python/articles/authentication.shtml
+
+
+Installation
+************
+
+::
+
+ $ python setup.py install
+
+
+Usage
+*****
+
+::
+
+ $ leech_invaders.py
+
+
+Dependecies
+***********
+
+* Python 2.6 or later (http://www.python.org)
+
+
+Project Information
+*******************
+
+:Author: Nycholas de Oliveira e Olivera
+:License: New BSD License
0 THANKS
No changes.
0 TODO
No changes.
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# A notifier leech invaders internet.
+# Copyright (c) 2011, Nycholas de Oliveira e Oliveira <nycholas@gmail.com>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of the Nycholas de Oliveira e Oliveira nor the names of
+# its contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+import re
+import base64
+import urllib2
+
+# DI-524
+URL = 'http://192.168.0.1/wlcl.htm'
+USERNAME = 'admin'
+PASSWORD = ''
+AUTHORIZATION = base64.encodestring('%s:%s' % (USERNAME, PASSWORD))[:-1]
+REGEX_TEMPLATE = r'<tr><td>(?P<datetime>.+?)</td><td>(?P<netmask>\w{2}-\w{2}-\w{2}-\w{2}-\w{2}-\w{2})</td></tr>'
+
+"""request = urllib2.Request(URL)
+request.add_header('Authorization', 'Basic %s' % AUTHORIZATION)
+
+handle = urllib2.urlopen(request)
+content = handle.read()
+"""
+
+passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
+passman.add_password(None, URL, USERNAME, PASSWORD)
+authhandler = urllib2.HTTPBasicAuthHandler(passman)
+opener = urllib2.build_opener(authhandler)
+urllib2.install_opener(opener)
+pagehandle = urllib2.urlopen(URL)
+content = pagehandle.read()
+
+pattern = re.compile(REGEX_TEMPLATE, re.IGNORECASE)
+groups = pattern.groupindex #sorted(groups, key=groups.__getitem__)
+searches = re.findall(pattern, content)
+
+print groups
+print searches
+print ' + FOUND %d SPACE INVADERS!' % len(searches)
Oops, something went wrong.

0 comments on commit f4087dc

Please sign in to comment.