Changed some formatting and status output. Also added manual chroot-setup. It's highly unreliable tho
This commit is contained in:
parent
73fd441734
commit
7d06fef7e9
|
|
@ -224,9 +224,9 @@ def get_instructions(target):
|
||||||
try:
|
try:
|
||||||
instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict)
|
instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict)
|
||||||
except:
|
except:
|
||||||
print('[E] JSON instructions failed to load for {}'.format(target))
|
print('[E] JSON syntax error in {}'.format('{}/{}.json'.format(args['profiles-path'], target)))
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
sleep(5)
|
exit(1)
|
||||||
|
|
||||||
return instructions
|
return instructions
|
||||||
|
|
||||||
|
|
@ -437,6 +437,8 @@ if __name__ == '__main__':
|
||||||
del(opts['pass-args'])
|
del(opts['pass-args'])
|
||||||
elif 'format' in opts:
|
elif 'format' in opts:
|
||||||
del(opts['format'])
|
del(opts['format'])
|
||||||
|
elif 'debug' in opts and opts['debug']:
|
||||||
|
print('[N] Complete command-string: '.format(command))
|
||||||
else:
|
else:
|
||||||
print('[-] Options: {}'.format(opts))
|
print('[-] Options: {}'.format(opts))
|
||||||
|
|
||||||
|
|
@ -536,6 +538,19 @@ if __name__ == '__main__':
|
||||||
## `systemd-nspawn -D /mnt --machine temporary` might be a more flexible solution in case of file structure changes.
|
## `systemd-nspawn -D /mnt --machine temporary` might be a more flexible solution in case of file structure changes.
|
||||||
if 'no-chroot' in opts and opts['no-chroot']:
|
if 'no-chroot' in opts and opts['no-chroot']:
|
||||||
o = run(command, opts)
|
o = run(command, opts)
|
||||||
|
elif 'chroot' in opts and opts['chroot']:
|
||||||
|
## Run in a manually set up version of arch-chroot (arch-chroot will break namespaces).
|
||||||
|
## This is a bit risky in case the file systems changes over the years, but we'll probably be safe adding this as an option.
|
||||||
|
## **> Prefer if possible to use 'no-chroot' instead which "live boots" the OS and runs the command.
|
||||||
|
o = run("mount /dev/mapper/luksdev /mnt")
|
||||||
|
o = run("cd /mnt; cp /etc/resolv.conf etc")
|
||||||
|
o = run("cd /mnt; mount -t proc /proc proc")
|
||||||
|
o = run("cd /mnt; mount --make-rslave --rbind /sys sys")
|
||||||
|
o = run("cd /mnt; mount --make-rslave --rbind /dev dev")
|
||||||
|
o = run('chroot /mnt /bin/bash -c "{c}"'.format(c=command))
|
||||||
|
o = run("cd /mnt; umount -R dev")
|
||||||
|
o = run("cd /mnt; umount -R sys")
|
||||||
|
o = run("cd /mnt; umount -R proc")
|
||||||
else:
|
else:
|
||||||
o = run('systemd-nspawn -D /mnt --machine temporary {c}'.format(c=command), opts)
|
o = run('systemd-nspawn -D /mnt --machine temporary {c}'.format(c=command), opts)
|
||||||
if type(conf[title][raw_command]) == bytes and len(conf[title][raw_command]) and not conf[title][raw_command] in o:
|
if type(conf[title][raw_command]) == bytes and len(conf[title][raw_command]) and not conf[title][raw_command] in o:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue