Fixed linux.enumerate.system.network when using old ip
Older versions of `ip` do not support the `-c=never` argument (or colors at all for that matter). Also, verified isort results, which made some other modifications.
This commit is contained in:
parent
c3a6654219
commit
3e92f0c964
|
@ -0,0 +1,26 @@
|
|||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
The Changelog starts with v0.4.1, because we did not keep one before that,
|
||||
and simply didn't have the time to go back and retroactively create one.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Fixed `linux.enumerate.system.network` to work with old and new style `ip`.
|
||||
- Fixed `ChannelFile.recvinto` which will no longer raise `BlockingIOError` (#126, #131)
|
||||
- Fixed sessions command with invalid session ID (#130)
|
||||
- Fixed zsh shell prompt color syntax (#130)
|
||||
|
||||
## [0.4.1] - 2021-06-14
|
||||
### Added
|
||||
- Differentiate prompt syntax for standard bash, zsh and sh (#126)
|
||||
- Added `-c=never` to `ip` command in `linux.enumerate.system.network`
|
||||
(#126)
|
||||
- Updated Dockerfile to properly build post-v0.4.0 releases (#125)
|
||||
- Added check for `nologin` shell to stop pwncat from accidentally
|
||||
closing the session (#116)
|
||||
- Resolved all flake8 errors (#123)
|
||||
- Improved EOF handling for Linux file-writes (#117)
|
|
@ -14,11 +14,7 @@ from rich.progress import (
|
|||
import pwncat
|
||||
from pwncat import util
|
||||
from pwncat.util import console
|
||||
from pwncat.commands import (
|
||||
Complete,
|
||||
Parameter,
|
||||
CommandDefinition,
|
||||
)
|
||||
from pwncat.commands import Complete, Parameter, CommandDefinition
|
||||
|
||||
|
||||
class Command(CommandDefinition):
|
||||
|
|
|
@ -6,7 +6,7 @@ from rich.table import Table, Column
|
|||
|
||||
import pwncat
|
||||
from pwncat.util import console
|
||||
from pwncat.commands import CommandDefinition, Complete, Parameter
|
||||
from pwncat.commands import Complete, Parameter, CommandDefinition
|
||||
|
||||
|
||||
class Command(CommandDefinition):
|
||||
|
|
|
@ -12,12 +12,7 @@ from rich.progress import (
|
|||
)
|
||||
|
||||
import pwncat
|
||||
from pwncat.util import (
|
||||
console,
|
||||
copyfileobj,
|
||||
human_readable_size,
|
||||
human_readable_delta,
|
||||
)
|
||||
from pwncat.util import console, copyfileobj, human_readable_size, human_readable_delta
|
||||
from pwncat.commands import Complete, Parameter, CommandDefinition
|
||||
|
||||
|
||||
|
|
|
@ -5,9 +5,7 @@ import rich.markup
|
|||
|
||||
import pwncat
|
||||
from pwncat.db import Fact
|
||||
from pwncat.facts.ability import (
|
||||
build_gtfo_ability,
|
||||
)
|
||||
from pwncat.facts.ability import build_gtfo_ability
|
||||
from pwncat.platform.linux import Linux
|
||||
from pwncat.modules.enumerate import Schedule, EnumerateModule
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import os
|
||||
import re
|
||||
|
||||
|
||||
from pwncat.db import Fact
|
||||
from pwncat.modules import Status
|
||||
from pwncat.subprocess import CalledProcessError
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import rich.markup
|
||||
|
||||
from pwncat.db import Fact
|
||||
from pwncat.subprocess import CalledProcessError
|
||||
from pwncat.platform.linux import Linux
|
||||
from pwncat.modules.enumerate import Schedule, EnumerateModule
|
||||
|
||||
|
@ -32,32 +33,36 @@ class Module(EnumerateModule):
|
|||
|
||||
try:
|
||||
output = session.platform.run(
|
||||
["ip", "-c=never", "addr"], capture_output=True, text=True
|
||||
["ip", "-c=never", "addr"], capture_output=True, text=True, check=True
|
||||
)
|
||||
if output.stdout:
|
||||
output = (
|
||||
line
|
||||
for line in output.stdout.replace("\r\n", "\n").split("\n")
|
||||
if line
|
||||
except CalledProcessError:
|
||||
try:
|
||||
output = session.platform.run(
|
||||
["ip", "addr"], capture_output=True, text=True, check=True
|
||||
)
|
||||
|
||||
interface = None
|
||||
|
||||
for line in output:
|
||||
if not line.startswith(" "):
|
||||
interface = line.split(":")[1].strip()
|
||||
continue
|
||||
|
||||
if interface is None:
|
||||
# This shouldn't happen. The first line should be an interface
|
||||
# definition, but just in case
|
||||
continue
|
||||
|
||||
line = line.strip()
|
||||
if line.startswith("inet"):
|
||||
address = line.split(" ")[1]
|
||||
yield InterfaceData(self.name, interface, address)
|
||||
|
||||
return
|
||||
except CalledProcessError:
|
||||
return
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
return
|
||||
|
||||
if output.stdout:
|
||||
output = (
|
||||
line for line in output.stdout.replace("\r\n", "\n").split("\n") if line
|
||||
)
|
||||
|
||||
interface = None
|
||||
|
||||
for line in output:
|
||||
if not line.startswith(" "):
|
||||
interface = line.split(":")[1].strip()
|
||||
continue
|
||||
|
||||
if interface is None:
|
||||
# This shouldn't happen. The first line should be an interface
|
||||
# definition, but just in case
|
||||
continue
|
||||
|
||||
line = line.strip()
|
||||
if line.startswith("inet"):
|
||||
address = line.split(" ")[1]
|
||||
yield InterfaceData(self.name, interface, address)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import shlex
|
||||
from typing import List
|
||||
|
||||
|
||||
from pwncat.db import Fact
|
||||
from pwncat.platform.linux import Linux
|
||||
from pwncat.modules.enumerate import Schedule, EnumerateModule
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
|
||||
|
||||
from pwncat.db import Fact
|
||||
from pwncat.util import Init
|
||||
from pwncat.platform.linux import Linux
|
||||
|
|
|
@ -1041,8 +1041,6 @@ class Linux(Platform):
|
|||
command += f" 2>{stderr}"
|
||||
elif stderr == pwncat.subprocess.DEVNULL:
|
||||
command += " 2>/dev/null"
|
||||
elif stderr == pwncat.subprocess.PIPE:
|
||||
command += " 2>&1"
|
||||
|
||||
if isinstance(stdin, str):
|
||||
command += f" 0<{stdin}"
|
||||
|
|
Loading…
Reference in New Issue