mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-02-06 06:55:00 +00:00
Merge branch 'main' into certs_downloader
This commit is contained in:
commit
b3e4165fab
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,4 +3,4 @@ savedfiles/
|
|||
settings.ini
|
||||
.env
|
||||
*.pyc
|
||||
*.crt
|
||||
*.crt
|
|
@ -36,6 +36,7 @@ CERT_KEY=cert.key
|
|||
CERT_DIR=certs/
|
||||
OPENSSL_BINPATH=openssl
|
||||
CLIENT_ENCODING=utf-8
|
||||
USE_EXTENSIONS=wayback.Wayback,bio.PyBio
|
||||
```
|
||||
|
||||
- (Optional) Create a certificate for SSL decryption
|
||||
|
|
17
base.py
17
base.py
|
@ -3,16 +3,17 @@
|
|||
# base.py
|
||||
# base (common) file
|
||||
#
|
||||
# Caterpillar Proxy - The simple and parasitic web proxy SPAM spam filter
|
||||
# Caterpillar Proxy - The simple web debugging proxy (formerly, php-httpproxy)
|
||||
# Namyheon Go (Catswords Research) <gnh1201@gmail.com>
|
||||
# https://github.com/gnh1201/caterpillar
|
||||
# Created at: 2024-05-20
|
||||
# Updated at: 2024-05-21
|
||||
# Updated at: 2024-07-09
|
||||
#
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
import importlib
|
||||
|
||||
client_encoding = 'utf-8'
|
||||
|
||||
|
@ -71,8 +72,16 @@ class Extension():
|
|||
cls.buffer_size = _buffer_size
|
||||
|
||||
@classmethod
|
||||
def register(cls, f):
|
||||
cls.extensions.append(f)
|
||||
def register(cls, s):
|
||||
module_name, class_name = s.strip().split('.')[0:2]
|
||||
module_path = 'plugins.' + module_name
|
||||
|
||||
try:
|
||||
module = importlib.import_module(module_path)
|
||||
_class = getattr(module, class_name)
|
||||
cls.extensions.append(_class())
|
||||
except (ImportError, AttributeError) as e:
|
||||
raise ImportError(class_name + " in the extension " + module_name)
|
||||
|
||||
@classmethod
|
||||
def get_filters(cls):
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
# Namyheon Go (Catswords Research) <gnh1201@gmail.com>
|
||||
# https://github.com/gnh1201/caterpillar
|
||||
# Created at: 2024-03-04
|
||||
# Updated at: 2024-03-13
|
||||
# Updated at: 2024-07-06
|
||||
#
|
||||
|
||||
import docker
|
||||
|
||||
from server import Extension
|
||||
from base import Extension
|
||||
|
||||
class Container(Extension):
|
||||
def __init__(self):
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# https://github.com/gnh1201/caterpillar
|
||||
#
|
||||
# Created in: 2022-10-06
|
||||
# Updated in: 2024-06-05
|
||||
# Updated in: 2024-07-06
|
||||
#
|
||||
|
||||
import io
|
||||
|
@ -19,7 +19,7 @@ import os.path
|
|||
from decouple import config
|
||||
from PIL import Image
|
||||
|
||||
from server import Extension
|
||||
from base import Extension
|
||||
|
||||
try:
|
||||
client_encoding = config('CLIENT_ENCODING', default='utf-8')
|
||||
|
|
34
plugins/nmap.py
Normal file
34
plugins/nmap.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/python3
|
||||
#
|
||||
# portscan.py
|
||||
# NMAP port scanning wrapper for Caterpillar Proxy
|
||||
#
|
||||
# Caterpillar Proxy - The simple web debugging proxy (formerly, php-httpproxy)
|
||||
# Namyheon Go (Catswords Research) <gnh1201@gmail.com>
|
||||
# https://github.com/gnh1201/caterpillar
|
||||
# Created at: 2022-01-26 (github.com/gnh1201/welsonjs)
|
||||
# Updated at: 2024-07-09
|
||||
#
|
||||
import sys
|
||||
import nmap
|
||||
import json
|
||||
|
||||
from base import Extension
|
||||
|
||||
class PortScanner(Extension):
|
||||
def __init__(self):
|
||||
self.type = "rpcmethod"
|
||||
self.method = "scan_ports_by_hosts"
|
||||
self.exported_methods = []
|
||||
|
||||
def dispatch(self, type, id, params, conn):
|
||||
hosts = params['hosts']
|
||||
binpath = params['binpath']
|
||||
|
||||
nm = nmap.PortScanner(nmap_search_path=(binpath,))
|
||||
result = nm.scan(hosts=hosts, arguments='-T5 -sV -p0-65535 --max-retries 0')
|
||||
|
||||
return result;
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
|
@ -7,12 +7,13 @@
|
|||
# Namyheon Go (Catswords Research) <gnh1201@gmail.com>
|
||||
# https://github.com/gnh1201/caterpillar
|
||||
# Created at: 2024-03-13
|
||||
# Updated at: 2024-03-13
|
||||
# Updated at: 2024-07-06
|
||||
#
|
||||
|
||||
import requests
|
||||
from decouple import config
|
||||
|
||||
from server import Extension
|
||||
from base import Extension
|
||||
|
||||
try:
|
||||
client_encoding = config('CLIENT_ENCODING')
|
||||
|
|
11
server.py
11
server.py
|
@ -7,7 +7,7 @@
|
|||
# Namyheon Go (Catswords Research) <gnh1201@gmail.com>
|
||||
# https://github.com/gnh1201/caterpillar
|
||||
# Created at: 2022-10-06
|
||||
# Updated at: 2024-06-20
|
||||
# Updated at: 2024-07-09
|
||||
#
|
||||
|
||||
import argparse
|
||||
|
@ -23,7 +23,6 @@ import time
|
|||
import hashlib
|
||||
import traceback
|
||||
import textwrap
|
||||
import importlib
|
||||
from datetime import datetime
|
||||
from platform import python_version
|
||||
|
||||
|
@ -48,6 +47,7 @@ try:
|
|||
client_encoding = config('CLIENT_ENCODING', default='utf-8')
|
||||
local_domain = config('LOCAL_DOMAIN', default='')
|
||||
proxy_pass = config('PROXY_PASS', default='')
|
||||
use_extensions = config('USE_EXTENSIONS', default='')
|
||||
except KeyboardInterrupt:
|
||||
print("\n[*] User has requested an interrupt")
|
||||
print("[*] Application Exiting.....")
|
||||
|
@ -499,9 +499,8 @@ def start(): #Main Program
|
|||
|
||||
if __name__== "__main__":
|
||||
# load extensions
|
||||
#Extension.register(importlib.import_module("plugins.fediverse").Fediverse())
|
||||
#Extension.register(importlib.import_module("plugins.container").Container())
|
||||
#Extension.register(importlib.import_module("plugins.wayback").Wayback())
|
||||
|
||||
for s in use_extensions.split(','):
|
||||
Extension.register(s)
|
||||
|
||||
# start Caterpillar
|
||||
start()
|
||||
|
|
5
web.py
5
web.py
|
@ -7,7 +7,7 @@
|
|||
# Namyheon Go (Catswords Research) <gnh1201@gmail.com>
|
||||
# https://github.com/gnh1201/caterpillar
|
||||
# Created at: 2024-05-20
|
||||
# Updated at: 2024-05-20
|
||||
# Updated at: 2024-07-10
|
||||
#
|
||||
|
||||
from flask import Flask, request, redirect, url_for, render_template
|
||||
|
@ -94,6 +94,7 @@ if __name__ == "__main__":
|
|||
Extension.set_protocol('http')
|
||||
|
||||
# load extensions
|
||||
#Extension.register(importlib.import_module("plugins.yourownplugin").YourOwnPlugin())
|
||||
for s in use_extensions.split(','):
|
||||
Extension.register(s)
|
||||
|
||||
app.run(debug=True, host='0.0.0.0', port=listening_port)
|
||||
|
|
Loading…
Reference in New Issue
Block a user