-
Notifications
You must be signed in to change notification settings - Fork 30
146 lines (127 loc) · 4.65 KB
/
search-username.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Search username
on:
workflow_dispatch:
inputs:
username:
description: 'Username to search'
required: true
include_titles:
description: 'Include titles in results'
required: true
type: boolean
default: true
include_descriptions:
description: 'Include descriptions in results'
required: true
type: boolean
default: true
include_html:
description: 'Include HTML content in results'
required: true
type: boolean
default: false
jobs:
username-search:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: |
sudo python -m pip install --upgrade pip
sudo pip install -r requirements.txt
sudo apt-get update && sudo apt-get install -y tor
- name: Start Tor service
run: |
sudo service tor start
sudo timeout 30 tail -f /var/log/tor/log || true
- name: Create Results directory
run: |
sudo mkdir -p Results
sudo chmod 777 Results
- name: Create proxy configuration
run: |
sudo bash -c 'cat > proxy_config.py << EOL
import aiohttp
from aiohttp_socks import ProxyConnector
import asyncio
import random
import time
import subprocess
last_rotation = 0
ROTATION_INTERVAL = 60 # 1 min in sec
async def get_tor_session():
connector = ProxyConnector.from_url("socks5://127.0.0.1:9050")
return aiohttp.ClientSession(connector=connector)
async def rotate_tor_identity():
global last_rotation
current_time = time.time()
if current_time - last_rotation >= ROTATION_INTERVAL:
try:
subprocess.run(["sudo", "killall", "-HUP", "tor"])
await asyncio.sleep(random.uniform(2, 4))
last_rotation = current_time
print("🔄 Rotated Tor identity")
except Exception as e:
print(f"Failed to rotate Tor identity: {e}")
pass
async def check_and_rotate():
while True:
await rotate_tor_identity()
await asyncio.sleep(10)
EOL'
sudo chmod 666 proxy_config.py
- name: Configure Tor control
run: |
sudo bash -c 'echo "ControlPort 9051" >> /etc/tor/torrc'
sudo bash -c 'echo "CookieAuthentication 1" >> /etc/tor/torrc'
sudo service tor restart
sudo timeout 30 tail -f /var/log/tor/log || true
- name: Create input simulation script
run: |
sudo bash -c 'cat > input_sim.py << EOL
def mock_input(prompt):
import os
if "proxy rotation display" in prompt.lower():
return "y"
if "Include titles" in prompt:
return "y" if os.environ.get("INCLUDE_TITLES", "false").lower() == "true" else "n"
if "Include descriptions" in prompt:
return "y" if os.environ.get("INCLUDE_DESCRIPTIONS", "false").lower() == "true" else "n"
if "Include HTML content" in prompt:
return "y" if os.environ.get("INCLUDE_HTML", "false").lower() == "true" else "n"
return ""
import builtins
builtins.input = mock_input
EOL'
sudo chmod 666 input_sim.py
- name: Run username search
env:
INCLUDE_TITLES: ${{ github.event.inputs.include_titles }}
INCLUDE_DESCRIPTIONS: ${{ github.event.inputs.include_descriptions }}
INCLUDE_HTML: ${{ github.event.inputs.include_html }}
PYTHONPATH: ${{ github.workspace }}
run: |
sudo python -c "
import input_sim
import asyncio
import proxy_config
from src.usr import main
async def run_search():
rotation_task = asyncio.create_task(proxy_config.check_and_rotate())
try:
main('${{ github.event.inputs.username }}')
finally:
rotation_task.cancel()
asyncio.run(run_search())
"
- name: Upload search results
uses: actions/upload-artifact@v4
with:
name: username-search-results
path: |
results/username-search_results.txt
src/username_search.log