xp4xbox / Python-Backdoor

This project is a cross-platform backdoor/reverse shell and post-exploitation tool written in Python3
GNU General Public License v3.0
714 stars 205 forks source link

client cannot reconnect after server crash #37

Closed ittech25 closed 4 years ago

ittech25 commented 4 years ago

client cannot reconnect after server crash

xp4xbox commented 4 years ago

in look into it.

xp4xbox commented 4 years ago

I think the real problem is the server crashing since even killing the process will still allow the client to reconnect. When does the server crash?

ittech25 commented 4 years ago

Yes, Server crash when killing the process. When server restart, client cannot reconnect

xp4xbox commented 4 years ago

try running both in a command window see what the output is.

I killed the server and restarted it and client still connected.

ittech25 commented 4 years ago

1 . I killed server ==> restart server => client connected ok

  1. I try killed server again ==> restart server => alway stuck in Listening on port

I test on windows 10 and ngrok

xp4xbox commented 4 years ago

I tried killing it multiple times, the client still connects. Maybe try changing line 442 in client.py to except: instead of except socket.error:.

ittech25 commented 4 years ago

Thank you @xp4xbox I change line 442 as you help error as image below when i killed server and reopen Server image

Client image

ittech25 commented 4 years ago

Test 2nd :

image

xp4xbox commented 4 years ago

Right below line 79 do you want to add print(client_info) so I can see what data that list has when you get that error?

ittech25 commented 4 years ago

error does not appear as picture above But killed the server and restart, it's stuck Connected image

Restart Server , stuck on Listening on port 3000, client not reconnect

image

ittech25 commented 4 years ago

Error appear

image

image

xp4xbox commented 4 years ago

Try changing line 154 in refresh_connections() from except socket.error: to just except:

ittech25 commented 4 years ago

Error below image

ittech25 commented 4 years ago

maybe error appear when i use ngrok ? image

xp4xbox commented 4 years ago

Whats ngrok

ittech25 commented 4 years ago

Ngrok : expose local server to internet (https://ngrok.com/) Because ISP in my country does not provide static ip

xp4xbox commented 4 years ago

Ah I think i know the problem do you want to add print(strUserInfo) to line 100 in client.py and show the output.

tidely commented 4 years ago

Error appear

image

image

I believe this error can be fixed with changing del arrAddresses[intCounter] to arrAddresses.remove(conn). This should prevent index out of range errors

ittech25 commented 4 years ago

Waiting result, image

xp4xbox commented 4 years ago

part of the problem is that since you are using ngroc hostname socket.gethostname() returns nothing. so il have to fix that.

did you try doing arrAddresses.remove(conn)?

ittech25 commented 4 years ago

Yes, i tried

tidely commented 4 years ago

Ngrok port forwarding service, I don't think it interferes with socket.gethostname()

ittech25 commented 4 years ago

image

xp4xbox commented 4 years ago

try this instead del arrAddresses[arrConnections.index(conn)] arrConnections.remove(conn) for thoses two lines.

xp4xbox commented 4 years ago

@Y4hL any reason why socket.gethostname returns blank then?

tidely commented 4 years ago

I think socket.gethostname() returns DESKTOP-XXXX

xp4xbox commented 4 years ago

oh wait yeah your right, platform.system() and platform.release() arent showing up

tidely commented 4 years ago

It think it would make it much easier if the list was sent in json format instead of splitting strings

ittech25 commented 4 years ago

try this instead del arrAddresses[arrConnections.index(conn)] arrConnections.remove(conn) for thoses two lines. Error does not appear Restart Server , stuck on Listening on port 3000 image

tidely commented 4 years ago

@xp4xbox I can make the client send the client_info in json format, but it would require an extra import, is that fine?

xp4xbox commented 4 years ago

That's fine

On Fri, Jun 12, 2020, 10:08 PM Y4hL notifications@github.com wrote:

@xp4xbox https://github.com/xp4xbox I can make the client send the client_info in json format, but it would require an extra import, is that fine?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xp4xbox/Python-Backdoor/issues/37#issuecomment-643553516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF6O6QSTWPHHQYIIE5VOIS3RWLNSJANCNFSM4NZ5QCCA .

tidely commented 4 years ago

38 @ittech25 try using ngrok with these changes

ittech25 commented 4 years ago

Error accepting connections! image

ittech25 commented 4 years ago

error below : image

ittech25 commented 4 years ago

Hi @xp4xbox @Y4hL I tried using serveo (same ngrok) - expose local server to internet Working fine. No error appear. Thank you for your support ^^