unix-thrust / beurk

BEURK Experimental Unix RootKit
GNU General Public License v3.0
362 stars 94 forks source link

client.py mistype #100

Closed evilpan closed 7 years ago

evilpan commented 7 years ago

Hey guys,

There's a mistake in clien.py which causes socket bind(2) to remote address but shows Connection Refused error. Here is how I fix it:

diff --git a/client.py b/client.py
index 72c82d2..9565746 100755
--- a/client.py
+++ b/client.py
@@ -25,14 +25,14 @@ class Client:
         try:
             self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
             self.s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-            self.s.bind((rhost, bport))
+            self.s.bind(('0.0.0.0', bport))
             self.s.connect((rhost, rport))
         except socket.gaierror:
             self._netfail("Socket error")
         except OverflowError:
             self._netfail("Bind error")
-        except:
-            self._netfail("Connection refused")
+        except Exception as e:
+            self._netfail(str(e))
nil0x42 commented 7 years ago

well seen, @pannzh ! can you consider doing a pull request please ? thank you !