Skip to content

Commit

Permalink
fix rooter
Browse files Browse the repository at this point in the history
  • Loading branch information
doomedraven committed Dec 20, 2024
1 parent cdb2202 commit 0777054
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/cuckoo/common/demux.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def _sf_children(child: sfFile): # -> bytes:
_ = path_write_file(path_to_extract, child.contents)
except Exception as e:
log.error(e, exc_info=True)
# ToDo AttributeError: 'File' object has no attribute 'get_type'
return (path_to_extract.encode(), child.platform, child.get_type(), child.get_size())


Expand Down
10 changes: 5 additions & 5 deletions utils/rooter.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ def run(*args):

def enable_ip_forwarding(sysctl="/usr/sbin/sysctl"):
log.debug("Enabling IPv4 forwarding")
run([sysctl, "-w" "net.ipv4.ip_forward=1"])
run(sysctl, "-w" "net.ipv4.ip_forward=1")


def check_tuntap(vm_name, main_iface):
"""Create tuntap device for qemu vms"""
try:
run([s.ip, "tuntap", "add", "dev", f"tap_{vm_name}", "mode", "tap", "user", username])
run([s.ip, "link", "set", "tap_{vm_name}", "master", main_iface])
run([s.ip, "link", "set", "dev", "tap_{vm_name}", "up"])
run([s.ip, "link", "set", "dev", main_iface, "up"])
run(s.ip, "tuntap", "add", "dev", f"tap_{vm_name}", "mode", "tap", "user", username)
run(s.ip, "link", "set", "tap_{vm_name}", "master", main_iface)
run(s.ip, "link", "set", "dev", "tap_{vm_name}", "up")
run(s.ip, "link", "set", "dev", main_iface, "up")
return True
except subprocess.CalledProcessError:
return False
Expand Down

0 comments on commit 0777054

Please sign in to comment.