try to exit if ports dont match
This commit is contained in:
@@ -104,6 +104,14 @@ def setup_options():
|
|||||||
type = str,
|
type = str,
|
||||||
help="Id name for backdoor"
|
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()
|
options=parser.parse_args()
|
||||||
if options.command == None:
|
if options.command == None:
|
||||||
parser.print_help(sys.stderr)
|
parser.print_help(sys.stderr)
|
||||||
@@ -361,6 +369,10 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
if opts.command == "keep":
|
if opts.command == "keep":
|
||||||
print(db.update(opts.id))
|
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(
|
ewrite(
|
||||||
" Connected\r"
|
" Connected\r"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ while true; do
|
|||||||
#~ _ssh pkill -a -f $USER@$HOSTNAME
|
#~ _ssh pkill -a -f $USER@$HOSTNAME
|
||||||
_autossh \
|
_autossh \
|
||||||
-R $reverseport:localhost:22 \
|
-R $reverseport:localhost:22 \
|
||||||
bin/ssh-backdoor keep $USER@$HOSTNAME
|
bin/ssh-backdoor keep $USER@$HOSTNAME $reverseport
|
||||||
|
|
||||||
for i in {1..10}; do
|
for i in {1..10}; do
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|||||||
Reference in New Issue
Block a user