pysoxy icon indicating copy to clipboard operation
pysoxy copied to clipboard

(enhancement)

Open Anonymous2716 opened this issue 2 years ago • 1 comments

Hi MisterDaneel I appreciate your code . I was thinking if I could block few IPs or let pass through only the IPs I want .it would be great . Thanks.

Anonymous2716 avatar Oct 17 '21 08:10 Anonymous2716

Yeah, this would be useful

sam1e-dev avatar Dec 26 '21 03:12 sam1e-dev

Decline Requests from specific sources

On the main function simply add

try:        
    wrapper, _ = new_socket.accept()
    wrapper.setblocking(1)
    if __[0] == "127.0.0.1": 
        wrapper.close()

or create list list with IPs

if __[0] in blacklist:
    wrapper.close()

Or to whilelist change it to that

if __[0] not in whilelist:
    wrapper.close()

senshiofficial avatar Nov 05 '23 22:11 senshiofficial

@senshiofficial would this also work if i use domain names? Or whatever is requested by the client? Thanks .

Anonymous2716 avatar Nov 06 '23 06:11 Anonymous2716

@senshiofficial would this also work if i use domain names? Or whatever is requested by the client? Thanks .

If a device or a Server is connecting to your Proxy it will always be a IP, if you want to block the destination which includes IPs and Domains you could try that at the request_client() function simply add

Blocklist Servers from being requested

if dst_addr == "Domain.com" or dst_addr in blacklist:
    return 0

you could also blocklist a port for whatever reason you wanna do that

if str(dst_port) == "80" or str(dst_port) in blacklistports:
    return 0

Just simply add that before return (dst_addr, dst_port)

senshiofficial avatar Nov 06 '23 11:11 senshiofficial

@senshiofficial thanks I will try testing later.

Anonymous2716 avatar Nov 06 '23 11:11 Anonymous2716