try to exit if ports dont match
This commit is contained in:
@@ -104,6 +104,14 @@ def setup_options():
|
||||
type = str,
|
||||
help="Id name for backdoor"
|
||||
)
|
||||
parser_wait.add_argument(
|
||||
action = 'store',
|
||||
dest = 'port',
|
||||
type = int,
|
||||
default = None,
|
||||
nargs = '?',
|
||||
help="The port given earlier. Can check against DB"
|
||||
)
|
||||
options=parser.parse_args()
|
||||
if options.command == None:
|
||||
parser.print_help(sys.stderr)
|
||||
@@ -361,6 +369,10 @@ if __name__ == "__main__":
|
||||
|
||||
if opts.command == "keep":
|
||||
print(db.update(opts.id))
|
||||
reverseport = db.get_port('reverseport',opts.id)
|
||||
if opts.port != reverseport:
|
||||
ewrite(" Need to refresh port\r")
|
||||
sys.exit(0)
|
||||
ewrite(
|
||||
" Connected\r"
|
||||
)
|
||||
|
||||
@@ -53,7 +53,7 @@ while true; do
|
||||
#~ _ssh pkill -a -f $USER@$HOSTNAME
|
||||
_autossh \
|
||||
-R $reverseport:localhost:22 \
|
||||
bin/ssh-backdoor keep $USER@$HOSTNAME
|
||||
bin/ssh-backdoor keep $USER@$HOSTNAME $reverseport
|
||||
|
||||
for i in {1..10}; do
|
||||
sleep 1
|
||||
|
||||
Reference in New Issue
Block a user