This guide demonstrates a simple NAT traversal setup using tcpdump
and nc
(Netcat) for UDP communication.
On the server, use tcpdump
to monitor the incoming UDP packets on port 12345
:
sudo tcpdump -i any udp and port 12345
#!/usr/bin/env python3 | |
# sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0 | |
# sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 | |
# unshare --user --map-user=0 | |
from dataclasses import dataclass | |
import fcntl | |
import getpass | |
import multiprocessing | |
import os |
import pathlib | |
import re | |
import os | |
import functools | |
def _translate(pat, STAR, QUESTION_MARK): | |
res = [] | |
add = res.append | |
i, n = 0, len(pat) | |
while i < n: |
import ctypes | |
import select | |
import pathlib | |
from ctypes import c_char_p, c_int, c_uint32 | |
import os | |
class EventStruct(ctypes.Structure): |
#!/bin/env python3 | |
"""This is a simple self-contained script to reload an arbitrary application | |
when its source changes (like using Flask in debug mode). It comes without | |
any 3rd party dependencies and can run standalone - a copy of this script is | |
all you need. | |
Examples: | |
./autostart.py -p '*.py' -i 'venv/*' flake8 autostart.py --max-line-length 120 | |
./autostart.py -p '*.py' -i 'venv/*' mypy ./autostart.py | |
./autostart.py -p '*.py' -i 'venv/*' "$(which python3)" ./server.py |
The following example demonstrates how to punch a hole through a stateful firewall using UDP. It opens a reverse shell on the server.
import pathlib | |
import pyais | |
from pyais.tracker import AISTrackEvent | |
def do_something(track): | |
# called every time an AISTrack is created or updated | |
print(track.mmsi, track) |
WAS_SPACE = 0 | |
NEW_LINE = 1 | |
NEW_WORD = 2 | |
WAS_WORD = 3 | |
SPACES = [9,10,11,12,13,32] | |
NEWLINE = 10 | |
def init_table(): | |
# 0 => was space |
FROM python:3.11-slim | |
WORKDIR /multi | |
COPY . . | |
CMD ["python", "./sender.py"] |
import torch | |
from llama_index.llms import HuggingFaceLLM | |
from llama_index.prompts import PromptTemplate | |
selected_model = 'mistralai/Mixtral-8x7B-Instruct-v0.1' | |
SYSTEM_PROMPT = """You are an AI assistant that answers questions in a friendly manner, based on the given source documents. Here are some rules you always follow: | |
- Generate human readable output, avoid creating output with gibberish text. | |
- Generate only the requested output, don't include any other language before or after the requested output. | |
- Never say thank you, that you are happy to help, that you are an AI agent, etc. Just answer directly. |