Comments (3)
Add verbose :)
pproxy -r socks5://{proxy['host']}:{proxy['port']}#{proxy['username']}:{proxy['password']} -l socks5://:{server_port} -vv
This prints out the current usage to stdout.
What I did is sent stdout to a class, and parsed the data.
Search for data_usage as such:
class OutputHandler:
def __init__(self):
pass
def write(self, message):
self.parse_and_handle_output(message.strip())
def flush(self):
pass
def print_to_output(self, message):
print(message, file=sys.__stdout__)
def parse_and_handle_output(self, output):
websites = re.findall(r'->\s(?:.*)->\s(.*):\d+', output)
data_usage = re.search(
"DIRECT: \d+ \(([\d.]+[KM])/s,([\d.]+[KM])/s\) PROXY: \d+ \(([\d.]+[KM])/s,([\d.]+[KM])/s\)",
output)
if websites: # Parse the websites
for website in websites:
self.print_to_output(f"URL: {website}")
elif data_usage and data_usage != "": # Parse the data usage
try:
direct, direct2, proxy, proxy2 = data_usage.groups()
direct_combined = self.to_megabytes(direct) + self.to_megabytes(direct2)
proxy_combined = self.to_megabytes(proxy) + self.to_megabytes(proxy2)
combined = float(direct_combined + proxy_combined)
self.print_to_output(round(combined, 4))
else:
if output and output != "":
self.print_to_output(output)
@staticmethod
def to_megabytes(value):
if value[-1] == 'M':
return float(value[:-1])
elif value[-1] == 'K':
return float(value[:-1]) / 1024
else:
return 0
sys.stdout = self.OutputHandler()
from python-proxy.
@strangeh21 Sorry, can you explain further? Are you running python proxy within a Python script? I'm running via command-line so I'm unclear on how I would adjust your solution.
from python-proxy.
@strangeh21 Sorry, can you explain further? Are you running python proxy within a Python script? I'm running via command-line so I'm unclear on how I would adjust your solution.
In short, verbose level 2 within commandline adds traffic logging. This is done by adding "-vv" When it is running you can press enter at any time to get a complete list of data usage.
from python-proxy.
Related Issues (20)
- How do i use authentication with my https server
- Save proxy logs
- Could not access Twitter
- Secure connection failed while generating self-signed certificate
- Hello sir I am HESSAM live in *Iran* if you take look in world news nowadays seeing in Iran ban all vpn and instagram and what up cause people against regime according netblocks report ...so glad to sign or show me way how I used this vpn code in all device I am beginner Python programming and little know code must written in text editors I want to know is it include all platform or just desktop? My second question is which file must or main for this vpn for example I see dns or ip is it include all of file or setup file just .
- pac not work
- Initial HTTP CONNECT and GET requests fail on 3.11.x, but work on 3.10.x and below HOT 1
- Run UDP socks5 on localhost error HOT 1
- Define port for outgoing packets
- socks5 udp无法使用
- http proxy fail for pproxy -l http://:9000/ -r http://httpbin.org/ -v HOT 1
- Empty reply from proxy server - even when remote target port is closed HOT 1
- Question about iptables
- Backward Proxy GET => Empty reply from server
- Dynamically set a username and password for the remote proxy
- How to print all request headers
- Possibility of redirecting traffic to warp?
- how to set systme proxy in python code,like 'dict(rserver=[remote])' ?
- Rules seem to be ignored with 'direct' HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-proxy.