File size: 5,535 Bytes
f325404
 
 
 
 
e4b31ed
f325404
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
147
148
149
150
import streamlit as st
import json
import time

# Streamlit app title
st.title("KayHGNG Warp On Warp maker for Hiddify v.6.1 ON WEB !")

# Open website in a new tab
url = "https://kayhgng.github.io/wireguardaccount/"
st.markdown(f"Click [here]({url}) to visit the website for Generating 2 Wireguard Accounts.", unsafe_allow_html=True)

# Info about developer
st.info("Developed by Alikay_h --> github.com/kayhgng")

# Input fields for user data
key_input = st.text_input("Please enter 'Iran' to make Warp on Warp for you - Github.com/kayhgng:")
ipv6 = st.text_input("Please Enter the Ipv6 iran:")
iran_private_key = st.text_input("Please Enter the Private key of Iran server:")
reserved_iran = st.text_input("Please Enter the reserved of Iran Server:")
ip_for_all = st.text_input("Clean IP:")
ip_port = st.text_input("Port Clean IP:")
ipv6_german = st.text_input("Please Enter the Ipv6 foreign:")
germany_private_key = st.text_input("Please Enter the Private key of foreign server:")
reserved_germany = st.text_input("Please Enter the reserved of foreign Server:")

# Button to generate configuration
if st.button("Generate Config"):
    if key_input == 'Iran' and ipv6 and iran_private_key and reserved_iran and ip_for_all and ip_port and ipv6_german and germany_private_key and reserved_germany:
        st.info("Wait... Generating...")
        
        # Simulate a 10-second delay
        time.sleep(10)
        
        # Config template
        config_template = {
            "route": {
                "geoip": {
                    "path": "geo-assets\\sagernet-sing-geoip-geoip.db"
                },
                "geosite": {
                    "path": "geo-assets\\sagernet-sing-geosite-geosite.db"
                },
                "rules": [
                    {
                        "inbound": "dns-in",
                        "outbound": "dns-out"
                    },
                    {
                        "port": 53,
                        "outbound": "dns-out"
                    },
                    {
                        "clash_mode": "Direct",
                        "outbound": "direct"
                    },
                    {
                        "clash_mode": "Global",
                        "outbound": "select"
                    }
                ],
                "auto_detect_interface": True,
                "override_android_vpn": True
            },
            "outbounds": [
                {
                    "type": "selector",
                    "tag": "select",
                    "outbounds": [
                        "auto",
                        "IP->Iran, KayH GNG",
                        "IP->Main, KayH GNG"
                    ],
                    "default": "auto"
                },
                {
                    "type": "urltest",
                    "tag": "auto",
                    "outbounds": [
                        "IP->Iran, KayH GNG",
                        "IP->Main, KayH GNG"
                    ],
                    "url": "http://cp.cloudflare.com/",
                    "interval": "10m0s"
                },
                {
                    "type": "wireguard",
                    "tag": "IP->Iran, KayH GNG",
                    "local_address": [
                        ipv6
                    ],
                    "private_key": iran_private_key,
                    "server": ip_for_all,
                    "server_port": int(ip_port) if ip_port.isdigit() else None,
                    "peer_public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
                    "reserved": [reserved_iran],
                    "mtu": 1280,
                    "fake_packets": "5-10"
                },
                {
                    "type": "wireguard",
                    "tag": "IP->Main, KayH GNG",
                    "detour": "IP->Iran, KayH GNG",
                    "local_address": [
                        ipv6_german
                    ],
                    "private_key": germany_private_key,
                    "server": ip_for_all,
                    "server_port": int(ip_port) if ip_port.isdigit() else None,
                    "peer_public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
                    "reserved": [reserved_germany],
                    "mtu": 1280,
                    "fake_packets": "5-10"
                },
                {
                    "type": "dns",
                    "tag": "dns-out"
                },
                {
                    "type": "direct",
                    "tag": "direct"
                },
                {
                    "type": "direct",
                    "tag": "bypass"
                },
                {
                    "type": "block",
                    "tag": "block"
                }
            ]
        }

        # Display the generated JSON configuration
        st.write("Generated Config:")
        st.json(config_template)

        # Convert dict to JSON string for downloading
        json_string = json.dumps(config_template, indent=4)

        # Download button
        st.download_button(
            label="Download Config",
            data=json_string,
            file_name='JsonKayH.txt',
            mime='application/json'
        )

        st.success("Generate Complete. Have fun with your config with Free Internet not filtered. KayH GNG")
    else:
        st.warning("Please fill all fields and enter 'Iran' to generate the configuration.")