This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gdata import service | |
import gdata | |
import atom | |
import feedparser | |
from time import * | |
banner = """ | |
Blogger Automatic Content Generation and Publication | |
Coded by Ricky L. Wilson | |
Post entries from RSS feeds to a blogger blog using Googles Blogger API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import urlparse | |
CONNECTION_TIMEOUT = 5 | |
CHUNK_SIZE = 1024 | |
HTTP_VERSION = 1.0 | |
CRLF = "\r\n\r\n" | |
socket.setdefaulttimeout(CONNECTION_TIMEOUT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import urlparse | |
CONNECTION_TIMEOUT = 5 | |
CHUNK_SIZE = 1024 | |
HTTP_VERSION = 1.0 | |
CRLF = "\r\n\r\n" | |
socket.setdefaulttimeout(CONNECTION_TIMEOUT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())) |
OlderNewer