Skip to content

Instantly share code, notes, and snippets.

View Ricky-Wilson's full-sized avatar
💭
Writing an ADB Lib

Ricky Wilson Ricky-Wilson

💭
Writing an ADB Lib
View GitHub Profile
@Ricky-Wilson
Ricky-Wilson / SeekAndDestroy.py
Created January 8, 2020 22:50
Find and exploit netgear routers
import nmap
# initialize the port scanner
nmScan = nmap.PortScanner()
# scan localhost for ports in range 21-443
nmScan.scan('127.0.0.1', '21-443')
# run a loop to print all the found result about the ports
for host in nmScan.all_hosts():
print('Host : %s (%s)' % (host, nmScan[host].hostname()))
import socket
import urlparse
CONNECTION_TIMEOUT = 5
CHUNK_SIZE = 1024
HTTP_VERSION = 1.0
CRLF = "\r\n\r\n"
socket.setdefaulttimeout(CONNECTION_TIMEOUT)
import socket
import urlparse
CONNECTION_TIMEOUT = 5
CHUNK_SIZE = 1024
HTTP_VERSION = 1.0
CRLF = "\r\n\r\n"
socket.setdefaulttimeout(CONNECTION_TIMEOUT)
@Ricky-Wilson
Ricky-Wilson / devserver.py
Created December 21, 2017 16:35
A handy little web server i use for testing things.
#!/usr/bin/env python
from http.server import BaseHTTPRequestHandler, HTTPServer
# HTTPRequestHandler class
class testHTTPServer_RequestHandler(BaseHTTPRequestHandler):
# GET
def do_GET(self):
# Send response status code
@Ricky-Wilson
Ricky-Wilson / convert_size.py
Created December 4, 2017 10:10
Convert file sizes to human readable format
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
i = int(math.floor(math.log(size_bytes, 1024)))
power = math.pow(1024, i)
size = round(size_bytes / power, 2)
return "%s %s" % (size, size_name[i])
#coding:utf-8
import urllib
import BeautifulSoup
import urlparse
import time
def main():
urlList = open("seed.txt","r").read().splitlines()
allowDomainList = set(open("allowDomain.txt","r").read().splitlines())
#http://www.diveintopython.net/html_processing/extracting_data.html
#https://docs.python.org/2/library/robotparser.html
import robotparser
import urllib
import csv
from urlparse import urlparse
def get_page(url):
sock = urllib.urlopen(url)
htmlSource = sock.read()
sock.close()
# -*- coding: utf-8 -*-
"""Simple RSS to HTML converter."""
__version__ = "0.0.2"
__author__ = "Ricky L Wilson"
from bs4 import BeautifulSoup
from feedparser import parse as parse_feed
from BeautifulSoup import BeautifulSoup
def _remove_attrs(soup):
for tag in soup.findAll(True):
tag.attrs = None
return soup
def example():
doc = '<html><head><title>test</title></head><body id="foo" onload="whatever"><p class="whatever">junk</p><div style="background: yellow;" id="foo" class="blah">blah</div></body></html>'
@Ricky-Wilson
Ricky-Wilson / dictionary.py
Created March 14, 2014 08:19
Scrape word definitions from dictionary.com with python
#!/usr/bin/python
from bs4 import BeautifulSoup as bs
import re
from requests import get
class dictionary:
def remove_non_ascii(self,text):
return re.sub(r'[^\x00-\x7F]+','', text)