Skip to content

Commit 108236b

Browse files
authored
Merge pull request #20 from Fortiphyd/qol-updates
QoL updates
2 parents d02ce6a + a55274c commit 108236b

File tree

8 files changed

+122
-1
lines changed

8 files changed

+122
-1
lines changed

attacker/Dockerfile

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,48 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
4444

4545
COPY default.xml /etc/xdg/xfce4/panel/default.xml
4646

47+
COPY index.html /opt/noVNC/index.html
48+
49+
4750
# Entrypoint script that sets password and starts the desktop session
4851
COPY start.sh /usr/local/bin/start.sh
4952
RUN chmod +x /usr/local/bin/start.sh
5053

54+
# allow passwordless sudo
55+
RUN echo "kali ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/kali \
56+
&& chmod 440 /etc/sudoers.d/kali
57+
58+
RUN sed -i 's/^#*autologin-user=.*/autologin-user=kali/' /etc/lightdm/lightdm.conf || true \
59+
&& sed -i 's/^#*autologin-user-timeout=.*/autologin-user-timeout=0/' /etc/lightdm/lightdm.conf || true
60+
61+
62+
# Disable XDG autostart entries that cause blank/lock in VNC/Xvfb
63+
RUN for f in xfce4-screensaver.desktop xfce4-power-manager.desktop light-locker.desktop; do \
64+
if [ -f "/etc/xdg/autostart/$f" ]; then \
65+
sed -i '/^Hidden=/d' "/etc/xdg/autostart/$f" && \
66+
printf '\nHidden=true\n' >> "/etc/xdg/autostart/$f"; \
67+
fi; \
68+
done
69+
70+
71+
72+
RUN mv /usr/bin/xflock4 /usr/bin/xflock4.real && \
73+
printf '#!/bin/sh\nexit 0\n' > /usr/bin/xflock4 && \
74+
chmod +x /usr/bin/xflock4
75+
76+
RUN if [ -f /usr/bin/xfce4-screensaver-command ] && [ ! -f /usr/bin/xfce4-screensaver-command.real ]; then \
77+
mv /usr/bin/xfce4-screensaver-command /usr/bin/xfce4-screensaver-command.real; \
78+
fi && \
79+
printf '#!/bin/sh\nexit 0\n' > /usr/bin/xfce4-screensaver-command && \
80+
chmod +x /usr/bin/xfce4-screensaver-command
81+
82+
COPY xfce-no-lock.sh /usr/local/bin/xfce-no-lock.sh
83+
RUN chmod +x /usr/local/bin/xfce-no-lock.sh
84+
85+
5186
EXPOSE ${NOVNC_PORT} ${VNC_PORT}
5287

5388
USER root
5489

5590
ENTRYPOINT ["/usr/local/bin/start.sh"]
56-
CMD ["supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
91+
CMD ["supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]

attacker/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="refresh" content="0; url=vnc.html?autoconnect=1">
5+
</head>
6+
</html>

attacker/xfce-no-lock.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
LOG=/tmp/xfce-no-lock.log
3+
echo "[$(date)] started" >> "$LOG"
4+
5+
until pgrep -u kali xfce4-session >/dev/null 2>&1; do
6+
sleep 0.5
7+
done
8+
9+
export DISPLAY=:1
10+
export XAUTHORITY=/home/kali/.Xauthority
11+
set +e
12+
13+
xfconf-query -c xfce4-session -p /general/LockScreen -t bool -s false --create
14+
xfconf-query -c xfce4-session -p /shutdown/LockScreen -t bool -s false --create
15+
16+
echo "[$(date)] completed" >> "$LOG"

attacker/xfce4-screensaver.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<channel name="xfce4-screensaver" version="1.0">
3+
<property name="lock-enabled" type="bool" value="false"/>
4+
<property name="idle-activation-enabled" type="bool" value="false"/>
5+
<property name="lock-delay" type="int" value="0"/>
6+
</channel>

attacker/xfce4-session.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<channel name="xfce4-session" version="1.0">
4+
<property name="general" type="empty">
5+
<property name="LockScreen" type="bool" value="false"/>
6+
<property name="FailsafeSessionName" type="string" value="Failsafe"/>
7+
<property name="LockCommand" type="string" value=""/>
8+
</property>
9+
<property name="sessions" type="empty">
10+
<property name="Failsafe" type="empty">
11+
<property name="IsFailsafe" type="bool" value="true"/>
12+
<property name="Count" type="int" value="5"/>
13+
<property name="Client0_Command" type="array">
14+
<value type="string" value="xfwm4"/>
15+
</property>
16+
<property name="Client0_Priority" type="int" value="15"/>
17+
<property name="Client0_PerScreen" type="bool" value="false"/>
18+
<property name="Client1_Command" type="array">
19+
<value type="string" value="xfsettingsd"/>
20+
</property>
21+
<property name="Client1_Priority" type="int" value="20"/>
22+
<property name="Client1_PerScreen" type="bool" value="false"/>
23+
<property name="Client2_Command" type="array">
24+
<value type="string" value="xfce4-panel"/>
25+
</property>
26+
<property name="Client2_Priority" type="int" value="25"/>
27+
<property name="Client2_PerScreen" type="bool" value="false"/>
28+
<property name="Client3_Command" type="array">
29+
<value type="string" value="Thunar"/>
30+
<value type="string" value="--daemon"/>
31+
</property>
32+
<property name="Client3_Priority" type="int" value="30"/>
33+
<property name="Client3_PerScreen" type="bool" value="false"/>
34+
<property name="Client4_Command" type="array">
35+
<value type="string" value="xfdesktop"/>
36+
</property>
37+
<property name="Client4_Priority" type="int" value="35"/>
38+
<property name="Client4_PerScreen" type="bool" value="false"/>
39+
</property>
40+
</property>
41+
<property name="shutdown" type="empty">
42+
<property name="LockScreen" type="bool" value="true"/>
43+
</property>
44+
</channel>

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ services:
9393
a-grfics-admin: # gets random bridge IP (e.g., 172.18.x.x)
9494
c-dmz-net:
9595
ipv4_address: 192.168.90.6
96+
sysctls:
97+
net.ipv4.conf.default.arp_announce: 2
98+
net.ipv4.conf.all.arp_announce: 2
9699

97100
router:
98101
image: fortiphyd/grfics-router

workstation/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,16 @@ Categories=Development;\n" \
8585
chmod +x /home/${USERNAME}/Desktop/OpenPLC.desktop && \
8686
chown ${USERNAME}:${USERNAME} /home/${USERNAME}/Desktop/OpenPLC.desktop
8787

88+
8889

8990
COPY places.sqlite /home/engineer/.mozilla/firefox/ztc0wi0n.default-release/places.sqlite
9091
RUN chown engineer /home/engineer/.mozilla/firefox/ztc0wi0n.default-release/places.sqlite
9192
RUN chown -R engineer:engineer /home/engineer
9293

94+
95+
COPY index.html /opt/noVNC/index.html
96+
97+
9398
EXPOSE ${NOVNC_PORT} ${VNC_PORT}
9499

95100
USER root

workstation/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="refresh" content="0; url=vnc.html?autoconnect=1">
5+
</head>
6+
</html>

0 commit comments

Comments
 (0)