Multithread Remote SSH with Python: mudanças entre as edições
Ir para navegação
Ir para pesquisar
(Criou página com '=run.py= <syntaxhighlight lang=python> #!/usr/bin/env python from src.activeInventory import ActiveInventory from src.configs import Config from src.argmenu import ArgMenu imp...') |
(→run.py) |
||
Linha 35: | Linha 35: | ||
main.remoteExecution() | main.remoteExecution() | ||
</syntaxhighlight> | |||
=runp.py= | |||
<syntaxhighlight lang=python> | |||
</syntaxhighlight> | |||
=src/activeinventory.py= | |||
<syntaxhighlight lang=python> | |||
</syntaxhighlight> | |||
=src/argmenu.py= | |||
<syntaxhighlight lang=python> | |||
</syntaxhighlight> | |||
=src/configs.py= | |||
<syntaxhighlight lang=python> | |||
</syntaxhighlight> | </syntaxhighlight> |
Edição das 18h07min de 25 de janeiro de 2022
run.py
#!/usr/bin/env python
from src.activeInventory import ActiveInventory
from src.configs import Config
from src.argmenu import ArgMenu
import time
class main:
def remoteExecution():
argsmenu = ArgMenu()
args = argsmenu.get_args()
activeInventory = ActiveInventory(args.outdir)
credfile = Config(args.cred)
credentials = credfile.get_data("credentials")
with open(args.servers, "r") as servers:
control = 1
count = 0
for server in servers:
count = count + 1
if control == 0:
control = 1
continue
for credential in credentials:
# time.sleep(1)
if control == 0:
break
if activeInventory.run_remote_command(command=args.cmd,
username=credential["username"],
password=credential["password"],
prefix=args.prefix,
server=server.replace("\n", "")) == 0:
control = 0
if __name__ == "__main__":
main.remoteExecution()