Skip to content

Commit 9915864

Browse files
committed
1.6.0 libc-dbg without upgrade
+ fixed #8, prevent libc upgrades with debug symbols + added some more type hinting + now using apt instead of apt-get
1 parent 21d4e4f commit 9915864

File tree

8 files changed

+38
-22
lines changed

8 files changed

+38
-22
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "vagd"
3-
version = "1.5.8"
3+
version = "1.6.0"
44
authors = [{ name = "0x6fe1be2" }]
55
description = "VirtuAlization GDb integrations in pwntools"
66
readme = "README.md"

src/vagd/templates.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,23 @@
99
1010
end"""
1111

12+
LOCK_PACKAGES = """
13+
ADD https://raw.githubusercontent.com/reproducible-containers/repro-sources-list.sh/v0.1.4/repro-sources-list.sh \
14+
/usr/local/bin/repro-sources-list.sh
15+
RUN bash /usr/local/bin/repro-sources-list.sh
16+
"""
1217

1318
DOCKER_TEMPLATE = """FROM {image}
1419
1520
USER root
1621
22+
{lock}
23+
1724
# install packages
1825
ENV DEBIAN_FRONTEND=noninteractive
19-
RUN apt-get update
20-
RUN apt-get install -y {packages}
26+
RUN apt update
27+
RUN apt install -y {packages}
28+
RUN apt clean && rm -rf /var/lib/apt/lists/*
2129
2230
# init user and ssh
2331
EXPOSE 22

src/vagd/virts/dogd.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
from typing import Dict, List, Optional
2+
from typing import Dict, List, Optional, Any
33

44
import docker
55

@@ -89,12 +89,12 @@ def __init__(
8989
user: str = DEFAULT_USER,
9090
forward: Optional[Dict[str, int]] = None,
9191
packages: Optional[List[str]] = None,
92-
symbols=True,
93-
rm=True,
92+
symbols: bool = True,
93+
rm: bool = True,
9494
ex: bool = False,
9595
fast: bool = False,
9696
alpine: bool = False,
97-
**kwargs,
97+
**kwargs: Any,
9898
):
9999
self._image = image
100100
self._name = Dogd.VAGD_PREFIX + os.path.basename(binary)
@@ -152,6 +152,7 @@ def _create_dockerfile(self):
152152
dockerfile.write(
153153
template.format(
154154
image=self._image,
155+
lock=templates.LOCK_PACKAGES if self._symbols else "",
155156
packages=" ".join(self._packages),
156157
user=self._user if self._user != "root" else Dogd.DEFAULT_USER,
157158
keyfile=os.path.basename(self._dockerdir + "keyfile.pub"),

src/vagd/virts/logd.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Iterable, Optional
1+
from typing import Iterable, Optional, Any
22

33
import pwnlib.args
44
import pwnlib.tubes
@@ -28,7 +28,7 @@ def _ssh_setup(self) -> None:
2828
"""
2929
helper.error("NOT IMPLEMENTED")
3030

31-
def __init__(self, binary: str, **kwargs):
31+
def __init__(self, binary: str, **kwargs: Any):
3232
"""
3333
:param binary: binary to execute
3434
"""
@@ -70,15 +70,17 @@ def put(self, file: str, remote: Optional[str] = None):
7070
"""
7171
helper.error("NOT IMPLEMENTED")
7272

73-
def debug(self, **kwargs) -> pwnlib.tubes.process.process:
73+
def debug(self, **kwargs: Any) -> pwnlib.tubes.process.process:
7474
"""
7575
run binary with gdb locally
7676
:param kwargs: pwntool arguments
7777
:rtype: pwnlib.tubes.process.process
7878
"""
7979
return self.pwn_debug(**kwargs)
8080

81-
def pwn_debug(self, argv: Optional[list[str]] = None, **kwargs) -> pwnlib.tubes.process.process:
81+
def pwn_debug(
82+
self, argv: Optional[list[str]] = None, **kwargs: Any
83+
) -> pwnlib.tubes.process.process:
8284
"""
8385
run binary with gdb locally
8486
:param argv: comandline arguments for binary
@@ -87,7 +89,9 @@ def pwn_debug(self, argv: Optional[list[str]] = None, **kwargs) -> pwnlib.tubes.
8789
"""
8890
return pwnlib.gdb.debug([self._binary] + argv, **kwargs)
8991

90-
def process(self, argv: Optional[list[str]] = None, **kwargs) -> pwnlib.tubes.process.process:
92+
def process(
93+
self, argv: Optional[list[str]] = None, **kwargs: Any
94+
) -> pwnlib.tubes.process.process:
9195
"""
9296
run binary locally
9397
:param argv: comandline arguments for binary
@@ -101,7 +105,7 @@ def start(
101105
argv: Optional[list[str]] = None,
102106
gdbscript: str = "",
103107
api: bool = False,
104-
**kwargs,
108+
**kwargs: Any,
105109
) -> pwnlib.tubes.process.process:
106110
"""
107111
start binary locally and return pwnlib.tubes.process.process

src/vagd/virts/pwngd.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
from abc import ABC, abstractmethod
33
from shutil import which
4-
from typing import Iterable, List, Union, Optional
4+
from typing import Iterable, List, Union, Optional, Any
55

66
import pwnlib.args
77
import pwnlib.filesystem
@@ -237,7 +237,7 @@ def debug(
237237
gdbscript: str = "",
238238
sysroot: Optional[str] = None,
239239
sysroot_debug: Optional[str] = None,
240-
**kwargs,
240+
**kwargs: Any,
241241
) -> pwnlib.tubes.ssh.ssh_channel:
242242
"""
243243
run binary in vm with gdb (pwnlib feature set)
@@ -281,7 +281,9 @@ def debug(
281281
**kwargs,
282282
)
283283

284-
def process(self, argv: Optional[list[str]] = None, **kwargs) -> pwnlib.tubes.ssh.ssh_channel:
284+
def process(
285+
self, argv: Optional[list[str]] = None, **kwargs: Any
286+
) -> pwnlib.tubes.ssh.ssh_channel:
285287
"""
286288
run binary in vm as process
287289
@@ -301,7 +303,7 @@ def start(
301303
sysroot: Optional[str] = None,
302304
sysroot_debug: Optional[str] = None,
303305
gdb_args: Optional[list[str]] = None,
304-
**kwargs,
306+
**kwargs: Any,
305307
) -> pwnlib.tubes.ssh.ssh_channel:
306308
"""
307309
start binary on remote and return pwnlib.tubes.process.process

src/vagd/virts/qegd.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import time
33
from shutil import copyfile, which
4-
from typing import Dict, List, Optional
4+
from typing import Dict, List, Optional, Any
55
from urllib.parse import urlparse
66
from urllib.request import urlretrieve
77

@@ -121,7 +121,7 @@ def __init__(
121121
bios: Optional[str] = None,
122122
detach: bool = False,
123123
custom: str = "",
124-
**kwargs,
124+
**kwargs: Any,
125125
):
126126
if not which(qemu):
127127
helper.error(qemu + " isn't installed")

src/vagd/virts/shgd.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import time
22

33
import pwnlib.tubes.ssh
4+
from typing import Any
45

56
from vagd import helper
67
from vagd.virts.pwngd import Pwngd
@@ -87,7 +88,7 @@ def __init__(
8788
host: str = DEFAULT_HOST,
8889
port: int = DEFAULT_PORT,
8990
keyfile: str = Pwngd.KEYFILE,
90-
**kwargs,
91+
**kwargs: Any,
9192
):
9293
"""
9394

src/vagd/virts/vagd.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import re
44
from shutil import which
5-
from typing import List, Optional
5+
from typing import List, Optional, Any
66

77
from vagd import helper, templates
88
from vagd.box import Box
@@ -95,7 +95,7 @@ def __init__(
9595
vagrantfile: str = VAGRANTFILE_PATH,
9696
vbox: Optional[str] = None,
9797
packages: Optional[List[str]] = None,
98-
**kwargs,
98+
**kwargs: Any,
9999
):
100100
"""
101101

0 commit comments

Comments
 (0)