Skip to content

Commit 8da1a42

Browse files
authored
Merge pull request #52 from 1hehaq/main
A surprise for you 😉
2 parents 57b0ab3 + 5f49fe2 commit 8da1a42

File tree

4 files changed

+495
-0
lines changed

4 files changed

+495
-0
lines changed

.github/workflows/ominis-search.yml

+204
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
name: Ominis Search
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
query:
7+
description: 'Search query/username'
8+
required: true
9+
language:
10+
description: 'Language code (e.g., lang_en)'
11+
required: false
12+
default: 'lang_en'
13+
country:
14+
description: 'Country code (e.g., US)'
15+
required: false
16+
default: 'US'
17+
start_date:
18+
description: 'Start date (YYYY-MM-DD)'
19+
required: false
20+
end_date:
21+
description: 'End date (YYYY-MM-DD)'
22+
required: false
23+
include_username_search:
24+
description: 'Perform username search'
25+
required: true
26+
type: boolean
27+
default: true
28+
include_titles:
29+
description: 'Include titles in username search results'
30+
required: false
31+
type: boolean
32+
default: true
33+
include_descriptions:
34+
description: 'Include descriptions in username search results'
35+
required: false
36+
type: boolean
37+
default: true
38+
include_html:
39+
description: 'Include HTML content in username search results'
40+
required: false
41+
type: boolean
42+
default: false
43+
44+
jobs:
45+
ominis-search:
46+
runs-on: ubuntu-22.04
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: '3.9'
54+
55+
- name: Install dependencies
56+
run: |
57+
sudo python -m pip install --upgrade pip
58+
sudo pip install -r requirements.txt
59+
sudo apt-get update && sudo apt-get install -y tor
60+
61+
- name: Start Tor service
62+
run: |
63+
sudo service tor start
64+
sudo timeout 30 tail -f /var/log/tor/log || true
65+
66+
- name: Create Results directory
67+
run: |
68+
sudo mkdir -p Results
69+
sudo chmod 777 Results
70+
71+
- name: Setup environment
72+
run: |
73+
sudo mkdir -p src/logs
74+
sudo touch src/gfetcherror.log
75+
sudo touch src/username_search.log
76+
sudo chmod -R 777 src/logs
77+
sudo chmod 666 src/gfetcherror.log
78+
sudo chmod 666 src/username_search.log
79+
80+
- name: Create proxy configuration
81+
run: |
82+
sudo bash -c 'cat > proxy_config.py << EOL
83+
import aiohttp
84+
from aiohttp_socks import ProxyConnector
85+
import asyncio
86+
import random
87+
import time
88+
import subprocess
89+
90+
last_rotation = 0
91+
ROTATION_INTERVAL = 60 # 1 min in sec
92+
93+
async def get_tor_session():
94+
connector = ProxyConnector.from_url("socks5://127.0.0.1:9050")
95+
return aiohttp.ClientSession(connector=connector)
96+
97+
async def rotate_tor_identity():
98+
global last_rotation
99+
current_time = time.time()
100+
101+
if current_time - last_rotation >= ROTATION_INTERVAL:
102+
try:
103+
subprocess.run(["sudo", "killall", "-HUP", "tor"])
104+
await asyncio.sleep(random.uniform(2, 4))
105+
last_rotation = current_time
106+
print("🔄 Rotated Tor identity")
107+
except Exception as e:
108+
print(f"Failed to rotate Tor identity: {e}")
109+
pass
110+
111+
async def check_and_rotate():
112+
while True:
113+
await rotate_tor_identity()
114+
await asyncio.sleep(10)
115+
EOL'
116+
sudo chmod 666 proxy_config.py
117+
118+
- name: Configure Tor control
119+
run: |
120+
sudo bash -c 'echo "ControlPort 9051" >> /etc/tor/torrc'
121+
sudo bash -c 'echo "CookieAuthentication 1" >> /etc/tor/torrc'
122+
sudo service tor restart
123+
sudo timeout 30 tail -f /var/log/tor/log || true
124+
125+
- name: Create input simulation script
126+
run: |
127+
sudo bash -c 'cat > input_sim.py << EOL
128+
def mock_input(prompt):
129+
import os
130+
if "proxy rotation display" in prompt.lower():
131+
return "y"
132+
if "Include titles" in prompt:
133+
return "y" if os.environ.get("INCLUDE_TITLES", "false").lower() == "true" else "n"
134+
if "Include descriptions" in prompt:
135+
return "y" if os.environ.get("INCLUDE_DESCRIPTIONS", "false").lower() == "true" else "n"
136+
if "Include HTML content" in prompt:
137+
return "y" if os.environ.get("INCLUDE_HTML", "false").lower() == "true" else "n"
138+
if "run a username search" in prompt.lower():
139+
return "y" if os.environ.get("DO_USERNAME_SEARCH", "false").lower() == "true" else "n"
140+
return ""
141+
142+
import builtins
143+
builtins.input = mock_input
144+
EOL'
145+
sudo chmod 666 input_sim.py
146+
147+
- name: Run web search
148+
env:
149+
PYTHONPATH: ${{ github.workspace }}
150+
run: |
151+
sudo python -c "
152+
import input_sim
153+
import asyncio
154+
import proxy_config
155+
from src.tools_handler import fetch_google_results
156+
157+
async def main():
158+
rotation_task = asyncio.create_task(proxy_config.check_and_rotate())
159+
try:
160+
await fetch_google_results(
161+
query='${{ github.event.inputs.query }}',
162+
language='${{ github.event.inputs.language }}',
163+
country='${{ github.event.inputs.country }}',
164+
date_range=('${{ github.event.inputs.start_date }}', '${{ github.event.inputs.end_date }}'),
165+
proxies=['socks5://127.0.0.1:9050']
166+
)
167+
finally:
168+
rotation_task.cancel()
169+
170+
asyncio.run(main())
171+
"
172+
173+
- name: Run username search
174+
if: ${{ github.event.inputs.include_username_search == 'true' }}
175+
env:
176+
INCLUDE_TITLES: ${{ github.event.inputs.include_titles }}
177+
INCLUDE_DESCRIPTIONS: ${{ github.event.inputs.include_descriptions }}
178+
INCLUDE_HTML: ${{ github.event.inputs.include_html }}
179+
PYTHONPATH: ${{ github.workspace }}
180+
run: |
181+
sudo python -c "
182+
import input_sim
183+
import asyncio
184+
import proxy_config
185+
from src.usr import main
186+
187+
async def run_search():
188+
rotation_task = asyncio.create_task(proxy_config.check_and_rotate())
189+
try:
190+
main('${{ github.event.inputs.query }}')
191+
finally:
192+
rotation_task.cancel()
193+
194+
asyncio.run(run_search())
195+
"
196+
197+
- name: Upload results
198+
uses: actions/upload-artifact@v4
199+
with:
200+
name: ominis-search-results
201+
path: |
202+
results/*.txt
203+
src/*.log
204+
if-no-files-found: warn

.github/workflows/search-username.yml

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

0 commit comments

Comments
 (0)