Skip to content

Commit 52d9e9b

Browse files
committed
# 1.3.4
+ removed separate local template + fixed dogd hash + updated test script
1 parent e11b6dc commit 52d9e9b

File tree

6 files changed

+17
-53
lines changed

6 files changed

+17
-53
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.3.3"
3+
version = "1.3.4"
44
authors = [
55
{ name="0x6fe1be2"},
66
]

src/vagd/cli.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
from vagd.virts.vagd import Vagd
1717

1818
DOGD_BOX = "Box.DOCKER_JAMMY"
19-
DOGD = "vm = Dogd(exe.path, image={box}, {args}) # Docker"
19+
DOGD = "vm = Dogd(BINARY, image={box}, {args}) # Docker"
2020
QEGD_BOX = "Box.QEMU_JAMMY"
21-
QEGD = "vm = Qegd(exe.path, img={box}, {args}) # Qemu"
22-
SHGD = "vm = Shgd(exe.path, user='user', host='localhost', port=22, {args}) # SSH"
21+
QEGD = "vm = Qegd(BINARY, img={box}, {args}) # Qemu"
22+
SHGD = "vm = Shgd(BINARY, user='user', host='localhost', port=22, {args}) # SSH"
2323

2424
# deprecated
2525
VAGD_BOX = "Box.VAGRANT_JAMMY64"
26-
VAGD = "vm = Vagd(exe.path, {box}, {args}) # Vagrant"
26+
VAGD = "vm = Vagd(BINARY, {box}, {args}) # Vagrant"
2727

2828
app = typer.Typer(context_settings={"help_option_names": ["-h", "--help"]})
2929

@@ -107,7 +107,7 @@ def template(
107107
templatePath = os.path.dirname(os.path.realpath(__file__))
108108
templateChunks = []
109109
aliasesPath = templatePath + "/res/aliases.txt"
110-
templatePath += '/res/local_template.txt' if local else '/res/template.txt'
110+
templatePath += '/res/template.txt'
111111
multi = False
112112
if not any((dogd, qegd, vagd, shgd)):
113113
dogd = qegd = True
@@ -166,6 +166,7 @@ def template(
166166
env=env,
167167
libc=libc,
168168
aslr=aslr,
169+
is_local=True if local else 'args.LOCAL',
169170
dependencies=', '.join(dependencies),
170171
vms=('\n' + ' ' * 4).join(vms))
171172

src/vagd/res/local_template.txt

-37
This file was deleted.

src/vagd/res/template.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ IP = '{ip}'
66
PORT = {port}
77
BINARY = '{binary}'
88
ARGS = []
9-
ENV = {env}
9+
ENV = {env} # os.environ
1010
GDB = f"""
1111
set follow-fork-mode parent
1212
@@ -26,10 +26,10 @@ def get_target(**kw):
2626
# context.log_level = 'debug'
2727
return remote(IP, PORT)
2828

29-
if args.LOCAL:
29+
if {is_local}:
3030
if args.GDB:
31-
return gdb.debug([exe.path] + ARGS, env=ENV, gdbscript=GDB, **kw)
32-
return process([exe.path] + ARGS, env=ENV, **kw)
31+
return gdb.debug([BINARY] + ARGS, env=ENV, gdbscript=GDB, **kw)
32+
return process([BINARY] + ARGS, env=ENV, **kw)
3333

3434
try:
3535
from vagd import {dependencies}, Box # only load vagd if needed

src/vagd/virts/dogd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _build_image(self):
117117
helper.info('building docker image')
118118
hash = self._image.find('@')
119119
if hash != -1:
120-
tag = self._image[:min(self._image[:hash].find(':'), hash)]
120+
tag = self._image[:hash]
121121
# add first 8 characters of hash
122122
tag += self._image[self._image.rfind(':'):][:8]
123123
else:

test/test.py

100644100755
+5-5
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ def virts():
7272
if os.path.exists(Dogd.LOCKFILE):
7373
os.remove(Dogd.LOCKFILE)
7474
log.info("Testing Docker for Ubuntu")
75-
vm = Dogd(exe.path, image=Box.DOCKER_NOBLE, packages=['cowsay'], tmp=True, ex=True, fast=True)
75+
vm = Dogd(exe.path + "_stat", image=Box.DOCKER_NOBLE, packages=['cowsay'], tmp=True, ex=True, fast=True)
7676
assert vm.is_new, "vm should be new"
7777
assert vm._ssh.which('cowsay'), "cowsay wasn't installed"
7878
yield vm
7979
vm._ssh.close()
8080

8181
log.info("Testing Docker for Ubuntu restore")
82-
vm = Dogd(exe.path, image=Box.DOCKER_NOBLE, tmp=True, ex=True, fast=True)
82+
vm = Dogd(exe.path + "_stat", image=Box.DOCKER_NOBLE, tmp=True, ex=True, fast=True)
8383
assert not vm.is_new, "vm shouldn't be new, restored"
8484
yield vm
8585
vm._ssh.close()
@@ -99,22 +99,22 @@ def virts():
9999

100100
os.system("vagd clean")
101101
log.info("Testing Qemu")
102-
vm = Qegd(exe.path, img=Box.QEMU_NOBLE, tmp=True, packages=['cowsay'], ex=True, fast=True)
102+
vm = Qegd(exe.path + "_stat", img=Box.QEMU_NOBLE, tmp=True, packages=['cowsay'], ex=True, fast=True, detach=True)
103103
assert vm.is_new, "vm should be new"
104104
assert vm._ssh.which('cowsay'), "cowsay wasn't installed"
105105
yield vm
106106
vm._ssh.close()
107107

108108
log.info("Testing Qemu restore")
109-
vm = Qegd(exe.path, img=Box.QEMU_NOBLE, tmp=True, ex=True, fast=True)
109+
vm = Qegd(exe.path + "_stat", img=Box.QEMU_NOBLE, tmp=True, ex=True, fast=True)
110110
assert not vm.is_new, "vm shouldn't be new, restored"
111111
yield vm
112112
vm._ssh.close()
113113
user = vm._user
114114
port = vm._port
115115

116116
log.info("Testing SSH")
117-
yield Shgd(exe.path, user=user, port=port, keyfile=vm._ssh.keyfile, tmp=True, ex=True, fast=True)
117+
yield Shgd(exe.path + "_stat", user=user, port=port, keyfile=vm._ssh.keyfile, tmp=True, ex=True, fast=True)
118118

119119

120120
for virt in virts():

0 commit comments

Comments
 (0)