pyhacks
Python module to ease writing scripts go over big amount of data in order to perform the same actions. A simple preconfigured threads and queue management and more hacking utils
Will elaborate more when it will get mature enough :)
capabilities
PyHacks
Using all below capabilities to easily manage threads and queue to perform operations on Item objects.
from pyhacks import PyHacks, Net
if __name__ == "__main__":
net = Net()
def handle_item(item):
host = item.get("host")
url = item.get("url")
replied_to_ping = net.reply_to_ping(host)
ip = net.resolve(host)
if ip == None:
return False
item.set("Reply To Ping", replied_to_ping)
item.set("ip", ip)
hacks.logger.green("{} {} {}".format(host, replied_to_ping, ip))
hacks.exporter.put(item)
return True
hacks = PyHacks(handle_item, 25, "output.csv")
hosts = hacks.parse.csv("ips.csv")
for host in hosts:
hacks.qt.put(host)
hacks.finish()
QueueThreads
QueueThreads class allows you to manage queue and threads easily.
qt = QueueThreads(handle_function, num_worker_threads, logger)
qt.put({"counter":1, "key1":"value1"})
qt.finish() # waiting until job is finished
parameters
handle_function - a function recevies item parameter from queue, will be used in all threads defined, return value has to be bool
def handle_item(item):
host = item.get("host")
url = item.get("url")
replied_to_ping = net.reply_to_ping(host)
ip = net.resolve(host)
if ip == None:
return False
item.set("Reply To Ping", replied_to_ping)
item.set("ip", ip)
hacks.logger.green("{} {} {}".format(host, replied_to_ping, ip))
hacks.exporter.put(item)
return True
num_worker_threads - numbers of threads used to run handle_functions on queue items logger - a Logger instance to be used for automatic logging
Parser
Parse files and returns list of Item objects
parse = Parser()
items = parse.csv("ips.csv")
for item in items:
qt.put(item)
Logger
Easy logging mechanism + writing into files under logs directory, used by QueueThreads for autoamtic logging
logger = Logger(verbose=False)
logger.green("text")
logger.red("text")
logger.yellow("text")
Exporter
Exporting Item objects into a csv/txt file
export = Exporter(output.csv)
export.put({"counter":1,"key1":"value"})
export.finish()
Metadata
Release files for pyhacks 1.0.20
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyhacks-1.0.20.tar.gz | 8.1 kB | Without provenance | Details for pyhacks-1.0.20.tar.gz |
Release files / pyhacks-1.0.20.tar.gz
| Download URL | pyhacks-1.0.20.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9e645c62c2a2054b347d3bf14a48cd2b5001a608330b41702e13a69efab2a8a
|
|
BLAKE2b-256 checksum How to use checksums |
9c24842df84f1b082d710cff146baa87fd1c3b174050e6b100180a36da05afe7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
|
Security for pyhacks 1.0.20
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.