mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 22:28:12 -05:00
script: add tor-test util
This commit is contained in:
3
script/lilith_spawns.py
Normal file → Executable file
3
script/lilith_spawns.py
Normal file → Executable file
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
# This file is part of DarkFi (https://dark.fi)
|
||||
#
|
||||
# Copyright (C) 2020-2024 Dyne.org foundation
|
||||
@@ -16,7 +17,6 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import asyncio, json, random, sys, time
|
||||
|
||||
|
||||
class JsonRpc:
|
||||
|
||||
async def start(self, server, port):
|
||||
@@ -105,5 +105,4 @@ async def main(argv):
|
||||
print(f" {host}")
|
||||
await rpc.stop()
|
||||
|
||||
|
||||
asyncio.run(main(sys.argv))
|
||||
|
||||
4
script/node_get-info.py
Normal file → Executable file
4
script/node_get-info.py
Normal file → Executable file
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
# This file is part of DarkFi (https://dark.fi)
|
||||
#
|
||||
# Copyright (C) 2020-2024 Dyne.org foundation
|
||||
@@ -16,7 +17,6 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import asyncio, json, random, sys, time
|
||||
|
||||
|
||||
class JsonRpc:
|
||||
|
||||
async def start(self, server, port):
|
||||
@@ -71,7 +71,6 @@ class JsonRpc:
|
||||
async def dnet_subscribe_events(self):
|
||||
return await self._subscribe("dnet.subscribe_events", [])
|
||||
|
||||
|
||||
async def main(argv):
|
||||
rpc = JsonRpc()
|
||||
while True:
|
||||
@@ -121,5 +120,4 @@ async def main(argv):
|
||||
|
||||
await rpc.stop()
|
||||
|
||||
|
||||
asyncio.run(main(sys.argv))
|
||||
|
||||
4
script/nodetool.py
Normal file → Executable file
4
script/nodetool.py
Normal file → Executable file
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
# This file is part of DarkFi (https://dark.fi)
|
||||
#
|
||||
# Copyright (C) 2020-2024 Dyne.org foundation
|
||||
@@ -16,7 +17,6 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import asyncio, json, random, sys, time
|
||||
|
||||
|
||||
class JsonRpc:
|
||||
|
||||
async def start(self, server, port):
|
||||
@@ -71,7 +71,6 @@ class JsonRpc:
|
||||
async def dnet_subscribe_events(self):
|
||||
return await self._subscribe("dnet.subscribe_events", [])
|
||||
|
||||
|
||||
async def main(argv):
|
||||
rpc = JsonRpc()
|
||||
while True:
|
||||
@@ -130,5 +129,4 @@ async def main(argv):
|
||||
await rpc.dnet_switch(False)
|
||||
await rpc.stop()
|
||||
|
||||
|
||||
asyncio.run(main(sys.argv))
|
||||
|
||||
29
script/tor-test.py
Executable file
29
script/tor-test.py
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/python
|
||||
# This file is part of DarkFi (https://dark.fi)
|
||||
#
|
||||
# Copyright (C) 2020-2024 Dyne.org foundation
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Tests if your local tor node is working
|
||||
|
||||
# pip install pysocks
|
||||
import socks
|
||||
import socket
|
||||
socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 9050)
|
||||
socket.socket = socks.socksocket
|
||||
import requests
|
||||
response = requests.get("https://myip.wtf/text")
|
||||
print(response.content)
|
||||
|
||||
Reference in New Issue
Block a user