Skip to content

Commit fd748f1

Browse files
committed
Project upload
0 parents  commit fd748f1

5 files changed

+281
-0
lines changed

.gitignore

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.idea/
2+
3+
# dotenv
4+
.env
5+
6+
# virtualenv
7+
.venv
8+
venv/
9+
ENV/
10+
11+
# Installer logs
12+
pip-log.txt
13+
pip-delete-this-directory.txt
14+
15+
# Unit test / coverage reports
16+
htmlcov/
17+
.tox/
18+
.coverage
19+
.coverage.*
20+
.cache
21+
nosetests.xml
22+
coverage.xml
23+
*.cover
24+
.hypothesis/
25+
26+
# Byte-compiled / optimized / DLL files
27+
__pycache__/
28+
*.py[cod]
29+
*$py.class
30+
31+
# C extensions
32+
*.so
33+
34+
# Distribution / packaging
35+
.Python
36+
env/
37+
build/
38+
develop-eggs/
39+
dist/
40+
downloads/
41+
eggs/
42+
.eggs/
43+
lib/
44+
lib64/
45+
parts/
46+
sdist/
47+
var/
48+
wheels/
49+
*.egg-info/
50+
.installed.cfg
51+
*.egg
52+
.idea
53+
/.idea

README.md

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# WarpOnWarp Generator
2+
3+
This Python program, named "WarpOnWarp Generator" facilitates the generation of WarpOnWarp configurations using an API provided by "zeroteam.top." WarpOnWarp is a service that enables users to access the free world internet securely through a singbox/hiddify configuration.
4+
5+
## Features
6+
7+
- Generates WarpOnWarp configurations using the API from "zeroteam.top."
8+
- Allows customization of clean IP addresses for enhanced privacy.
9+
- Saves the generated configurations in the `/output` directory.
10+
11+
## Prerequisites
12+
13+
- Python 3.x
14+
- Requests library (Install using `pip install requests`) or:
15+
16+
17+
## Usage
18+
19+
1. Clone the repository to your local machine.
20+
```bash
21+
git clone https://github.com/drunkleen/warp-on-warp-generator
22+
```
23+
2. Install the necessary dependencies (`requests` library).
24+
```bash
25+
pip install -r requirements.txt
26+
```
27+
3. Run the `warp-on-warp-generator.py` script.
28+
```bash
29+
python warp-on-warp-generator.py
30+
```
31+
4. Follow the prompts to customize the configuration, if desired.
32+
5. Configurations will be saved in the `/output` directory.
33+
34+
## How It Works
35+
36+
1. The program loads a JSON template (`config-template.json`) which serves as the basis for the WarpOnWarp configuration.
37+
2. It registers two Warp accounts using the API from "zeroteam.top."
38+
3. The program then populates the JSON template with the obtained account details.
39+
4. Optionally, the user can choose to use custom clean IP addresses for added privacy.
40+
5. Finally, the modified JSON configuration is saved in the `/output` directory with a randomly generated filename.
41+
42+
## Configuration Customization
43+
44+
- The program prompts the user if they want to use a custom clean IP address. If selected, the user can input the IP address and port.
45+
- If custom clean IP is not selected, default IP addresses and ports are used.
46+
47+
## Files
48+
49+
- `warp-on-warp-generator.py`: The Python script for generating WarpOnWarp configurations.
50+
- `config-template.json`: Template JSON file for the WarpOnWarp configuration.
51+
- `/output`: Directory to store the generated configurations.
52+
53+
## Disclaimer
54+
55+
- This program is provided as-is, without any warranties. Use it at your own risk.
56+
- Ensure compliance with applicable laws and terms of service when using the generated configurations.
57+
58+
## Credits
59+
60+
- This program utilizes the API provided by "zeroteam.top" for WarpOnWarp configuration generation.
61+
62+
## License
63+
64+
- This project is licensed under the [MIT License](LICENSE).
65+
66+
For any issues or suggestions, feel free to open an issue or submit a pull request. Thank you for using the WarpOnWarp Generator!

config-template.json

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"route": {
3+
"geoip": {
4+
"path": "geo-assets\\\\sagernet-sing-geoip-geoip.db"
5+
},
6+
"geosite": {
7+
"path": "geo-assets\\\\sagernet-sing-geosite-geosite.db"
8+
},
9+
"rules": [
10+
{
11+
"inbound": "dns-in",
12+
"outbound": "dns-out"
13+
},
14+
{
15+
"port": 53,
16+
"outbound": "dns-out"
17+
},
18+
{
19+
"clash_mode": "Direct",
20+
"outbound": "direct"
21+
},
22+
{
23+
"clash_mode": "Global",
24+
"outbound": "select"
25+
}
26+
],
27+
"auto_detect_interface": true,
28+
"override_android_vpn": true
29+
},
30+
"outbounds": [
31+
{
32+
"type": "selector",
33+
"tag": "select",
34+
"outbounds": [
35+
"auto",
36+
"IP-> Your IP address",
37+
"IP-> Main"
38+
],
39+
"default": "auto"
40+
},
41+
{
42+
"type": "urltest",
43+
"tag": "auto",
44+
"outbounds": [
45+
"IP-> Your IP address",
46+
"IP-> Main"
47+
],
48+
"url": "http://cp.cloudflare.com/",
49+
"interval": "10m0s"
50+
},
51+
{
52+
"type": "wireguard",
53+
"tag": "IP-> Your IP address",
54+
"local_address": [
55+
"172.16.0.2/32",
56+
"[ipv6]"
57+
],
58+
"private_key": "[private_key]",
59+
"server": "ip",
60+
"server_port": ["port"],
61+
"peer_public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
62+
"reserved": ["reserved"],
63+
"mtu": 1280,
64+
"fake_packets": "5-10"
65+
},
66+
{
67+
"type": "wireguard",
68+
"tag": "IP-> Main",
69+
"detour": "IP-> Your IP address",
70+
"local_address": [
71+
"172.16.0.2/32",
72+
"ipv6"
73+
],
74+
"private_key": "private",
75+
"server": "[ip]",
76+
"server_port": ["port"],
77+
"peer_public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
78+
"reserved": ["reserved"],
79+
"mtu": 1280,
80+
"fake_packets": "5-10"
81+
},
82+
{
83+
"type": "dns",
84+
"tag": "dns-out"
85+
},
86+
{
87+
"type": "direct",
88+
"tag": "direct"
89+
},
90+
{
91+
"type": "direct",
92+
"tag": "bypass"
93+
},
94+
{
95+
"type": "block",
96+
"tag": "block"
97+
}
98+
]
99+
}

requirements.txt

184 Bytes
Binary file not shown.

warp-on-warp-generator.py

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import os
2+
import requests
3+
import json
4+
import random
5+
import string
6+
7+
8+
def generate_random_string() -> str:
9+
return ''.join(random.choices(string.ascii_letters + string.digits, k=8))
10+
11+
12+
def load_json_template() -> json:
13+
try:
14+
with open("config-template.json", "r") as file:
15+
data = json.load(file)
16+
return data
17+
except IOError:
18+
print("Error loading:\nconfig-template.json not found\n\n", IOError)
19+
20+
21+
def check_output_dir():
22+
output_dir = "output"
23+
if not os.path.exists(output_dir):
24+
os.makedirs(output_dir)
25+
26+
27+
def register_warp_account() -> json:
28+
try:
29+
return requests.get("https://api.zeroteam.top/warp?format=sing-box").json()
30+
except requests.exceptions.RequestException as e:
31+
print("Error registering")
32+
33+
34+
if __name__ == '__main__':
35+
json_file_to_save = load_json_template()
36+
first_account = register_warp_account()
37+
second_account = register_warp_account()
38+
39+
json_file_to_save["outbounds"][2]["local_address"][1] = first_account['local_address'][1]
40+
json_file_to_save["outbounds"][2]["private_key"] = first_account['private_key']
41+
json_file_to_save["outbounds"][2]["reserved"] = first_account['reserved']
42+
43+
json_file_to_save["outbounds"][3]["local_address"][1] = second_account['local_address'][1]
44+
json_file_to_save["outbounds"][3]["private_key"] = second_account['private_key']
45+
json_file_to_save["outbounds"][3]["reserved"] = second_account['reserved']
46+
47+
if input("Do you want to use custom clean IP? (y/N): ").lower() == "y":
48+
ip = input("Enter clean IP address: ").strip()
49+
port = int(input("Enter clean the port of the clean IP: ").strip())
50+
51+
json_file_to_save["outbounds"][3]["server"] = ip
52+
json_file_to_save["outbounds"][3]["server_port"] = port
53+
json_file_to_save["outbounds"][3]["server"] = ip
54+
json_file_to_save["outbounds"][3]["server_port"] = port
55+
else:
56+
json_file_to_save["outbounds"][2]["server"] = "162.159.193.10"
57+
json_file_to_save["outbounds"][2]["server_port"] = 2408
58+
json_file_to_save["outbounds"][3]["server"] = "162.159.193.10"
59+
json_file_to_save["outbounds"][3]["server_port"] = 2408
60+
61+
check_output_dir()
62+
with open(f"output/{generate_random_string()}.json", "w") as f:
63+
f.write(json.dumps(json_file_to_save))

0 commit comments

Comments
 (0)