diff --git a/output.html b/output.html new file mode 100644 index 0000000..e05445a --- /dev/null +++ b/output.html @@ -0,0 +1,331 @@ + + + + + + + + + + + + + + + + + + + + + + Document + + + + + +
+

TL;DR

+

too log didn't read

+
+ + + +
+
+
+
+
+

What happened today?

+
last_user_added
+

Feb 29 15:08:48 chopchop useradd[8744]: new user: name=colord, UID=118, GID=130, home=/var/lib/colord, shell=/usr/sbin/nologin, from=/dev/pts/4 + + + + A level 1 annotation for last_user_added + + + +

users_created_today
+

-- No entries -- + + + + A level 1 annotation for users_created_today + + + +

list_active_services
+

[ - ] alsa-utils + [ - ] apparmor + [ + ] atop + [ + ] atopacct + [ + ] bluetooth + [ - ] console-setup.sh + [ + ] cron + [ + ] cups + [ - ] cups-browsed + [ + ] dbus + [ + ] dphys-swapfile + [ + ] exim4 + [ + ] fake-hwclock + [ - ] fcgiwrap + [ - ] hwclock.sh + [ + ] incron + [ - ] keyboard-setup.sh + [ + ] kmod + [ + ] networking + [ - ] nfs-common + [ + ] nginx + [ - ] paxctld + [ - ] php7.4-fpm + [ + ] php8.2-fpm + [ + ] procps + [ - ] pulseaudio-enable-autospawn + [ + ] raspi-config + [ + ] rng-tools-debian + [ - ] rpcbind + [ - ] rsync + [ - ] saned + [ + ] ssh + [ - ] sudo + [ + ] triggerhappy + [ + ] udev + [ - ] uuidd + [ - ] x11-common + + + + A level 1 annotation for list_active_services + + + +

list_groups
+

root:x:0: +daemon:x:1: +bin:x:2: +sys:x:3: +adm:x:4:xpub +tty:x:5: +disk:x:6: +lp:x:7:aleevadh,bernabereit,lorenzo,mania,mszw,mxrwho,river,senak,thijsoid,v,vitrinekast,wang,xpub,xpub,zerozeta,zz1,www-data +mail:x:8: +news:x:9: +uucp:x:10: +man:x:12: +proxy:x:13: +kmem:x:15: +dialout:x:20:xpub,mb,river,joak,aleevadh,bernabereit,lorenzo,mania,mszw,mxrwho,river,senak,thijsoid,v,vitrinekast,wang,xpub,zerozeta,zz1,murtaugh,mb +fax:x:21: +voice:x:22: +cdrom:x:24:xpub +floppy:x:25: +tape:x:26: +sudo:x:27:joak,aleevadh,bernabereit,lorenzo,mania,mszw,mxrwho,river,senak,thijsoid,v,vitrinekast,wang,xpub,zerozeta,zz1,murtaugh,mb,strt,cristina,chipchip,killer +audio:x:29:xpub,river,pulse,vitrinekast,liquidsoap +dip:x:30: +www-data:x:33:vitrinekast +backup:x:34: +operator:x:37: +list:x:38: +irc:x:39: +src:x:40: +gnats:x:41: +shadow:x:42: +utmp:x:43: +video:x:44:xpub +sasl:x:45: +plugdev:x:46:xpub +staff:x:50: +games:x:60:xpub +users:x:100:xpub,murtaugh,aleevadh,h4ck3r,mania,mszw,mxrwho,senak,v,wang,zerozeta,bernabereit,lorenzo,mb,river,thijsoid,vitrinekast,zz1,joak,cristina,strt,chipchip,killer +nogroup:x:65534: +systemd-journal:x:101: +systemd-network:x:102: +systemd-resolve:x:103: +input:x:104:xpub +kvm:x:105: +render:x:106:xpub +crontab:x:107: +netdev:x:108:xpub +systemd-timesync:x:109: +messagebus:x:110: +bluetooth:x:112: +avahi:x:113: +spi:x:999:xpub +i2c:x:998:xpub +gpio:x:997:xpub +systemd-coredump:x:996: +xpub:x:1000: +vitrinekast:x:1001: +senak:x:1002: +lorenzo:x:1003: +mxrwho:x:1004: +bernabereit:x:1005: +river:x:1006: +v:x:1007: +mania:x:1008: +aleevadh:x:1009: +h4ck3r:x:1010: +thijsoid:x:1011: +mszw:x:1012: +zerozeta:x:1013: +wang:x:1014: +zz1:x:1015: +Debian-exim:x:114: +rtkit:x:115: +murtaugh:x:1017: +mb:x:1016: +pulse:x:116: +pulse-access:x:117: +mlocate:x:118: +uuidd:x:119: +joak:x:1018: +sgx:x:120: +plocate:x:121: +polkitd:x:995: +_ssh:x:111: +pipewire:x:122: +cristina:x:1019: +strt:x:1020: +incron:x:123: +chipchip:x:1021: +killer:x:1022: +tcpdump:x:124: +liquidsoap:x:125: +lpadmin:x:126:river,xpub +ssl-cert:x:127: +scanner:x:128:saned +saned:x:129: +colord:x:130: + + + + A level 1 annotation for list_groups + + + +

since_last_boot
+

2024-03-05 08:13:37 + + + + A level 1 annotation for since_last_boot + + + +

list_package_installs
+

2024-03-10 15:16:14 install libtk8.6:armhf 8.6.13-2 +2024-03-10 15:16:14 status half-installed libtk8.6:armhf 8.6.13-2 +2024-03-10 15:16:15 install tk8.6-blt2.5:armhf 2.5.3+dfsg-4.1 +2024-03-10 15:16:15 status half-installed tk8.6-blt2.5:armhf 2.5.3+dfsg-4.1 +2024-03-10 15:16:15 install blt:armhf 2.5.3+dfsg-4.1 +2024-03-10 15:16:15 status half-installed blt:armhf 2.5.3+dfsg-4.1 +2024-03-10 15:16:15 install python3-tk:armhf 3.11.2-3 +2024-03-10 15:16:15 status half-installed python3-tk:armhf 3.11.2-3 +2024-03-10 15:16:16 status installed libtk8.6:armhf 8.6.13-2 +2024-03-10 15:16:16 status installed tk8.6-blt2.5:armhf 2.5.3+dfsg-4.1 +2024-03-10 15:16:16 status installed blt:armhf 2.5.3+dfsg-4.1 +2024-03-10 15:16:16 status installed python3-tk:armhf 3.11.2-3 +2024-03-10 15:16:16 status installed libc-bin:armhf 2.36-9+rpt2+deb12u4 +2024-03-12 14:29:01 install python3-markupsafe:armhf 2.1.2-1 +2024-03-12 14:29:01 status half-installed python3-markupsafe:armhf 2.1.2-1 +2024-03-12 14:29:02 install python3-jinja2:all 3.1.2-1 +2024-03-12 14:29:02 status half-installed python3-jinja2:all 3.1.2-1 +2024-03-12 14:29:02 status installed python3-markupsafe:armhf 2.1.2-1 +2024-03-12 14:29:03 status installed python3-jinja2:all 3.1.2-1 +2024-03-15 09:51:48 install libhttp-parser2.9:armhf 2.9.4-5 +2024-03-15 09:51:48 status half-installed libhttp-parser2.9:armhf 2.9.4-5 +2024-03-15 09:51:48 install libmbedx509-1:armhf 2.28.3-1 +2024-03-15 09:51:48 status half-installed libmbedx509-1:armhf 2.28.3-1 +2024-03-15 09:51:48 install libmbedtls14:armhf 2.28.3-1 +2024-03-15 09:51:48 status half-installed libmbedtls14:armhf 2.28.3-1 +2024-03-15 09:51:48 install libgit2-1.5:armhf 1.5.1+ds-1+deb12u1 +2024-03-15 09:51:48 status half-installed libgit2-1.5:armhf 1.5.1+ds-1+deb12u1 +2024-03-15 09:51:49 install bat:armhf 0.22.1-4 +2024-03-15 09:51:49 status half-installed bat:armhf 0.22.1-4 +2024-03-15 09:51:50 status installed libmbedx509-1:armhf 2.28.3-1 +2024-03-15 09:51:50 status installed libmbedtls14:armhf 2.28.3-1 +2024-03-15 09:51:50 status installed libhttp-parser2.9:armhf 2.9.4-5 +2024-03-15 09:51:50 status installed libgit2-1.5:armhf 1.5.1+ds-1+deb12u1 +2024-03-15 09:51:50 status installed bat:armhf 0.22.1-4 +2024-03-15 09:51:50 status installed libc-bin:armhf 2.36-9+rpt2+deb12u4 +2024-03-15 09:55:52 status installed bat:armhf 0.22.1-4 +2024-03-15 09:55:52 status half-installed bat:armhf 0.22.1-4 +2024-03-15 09:55:52 status not-installed bat:armhf + + + + A level 1 annotation for list_package_installs + + + +

list_package_upgrade
+

+ + + A level 1 annotation for list_package_upgrade + + + +

list_package_remove
+

2024-03-15 09:55:52 startup packages remove +2024-03-15 09:55:52 remove bat:armhf 0.22.1-4 + + + + A level 1 annotation for list_package_remove + + + +

device_info
+

Raspberry Pi 4 Model B Rev 1.4 + + + A level 1 annotation for device_info + + + +

debian_version
+

12.1 + + + + A level 1 annotation for debian_version + + + +

kernel_version
+

Linux chopchop 6.1.65-v8+ #1703 SMP PREEMPT Tue Dec 5 16:25:41 GMT 2023 aarch64 GNU/Linux + + + + A level 1 annotation for kernel_version + + + +

+
+ + + + + + + + + + diff --git a/script.py b/script.py index 9b5fad3..8cab294 100644 --- a/script.py +++ b/script.py @@ -3,28 +3,46 @@ from jinja2 import Environment, FileSystemLoader ## Getting the data import subprocess -last_user_added = subprocess.run(["sudo", "journalctl", "--output=json-pretty","_COMM=useradd","-r","-n","1","--output-fields=MESSAGE"], capture_output=True) -users_created_today = subprocess.run(["sudo", "journalctl", "--output=json-pretty","_COMM=useradd","-r","-n","1","--output-fields=MESSAGE", "-S","yesterday"], capture_output=True) +# last_user_added = subprocess.run(["sudo", "journalctl","_COMM=useradd","-r","-n","1","--output-fields=MESSAGE"], capture_output=True).stdout.decode('UTF-8') +# users_created_today = subprocess.run(["sudo", "journalctl","_COMM=useradd","-r","-n","1","--output-fields=MESSAGE", "-S","yesterday"], capture_output=True).stdout.decode('UTF-8') +# list_active_services = subprocess.run(["sudo", "journalctl","_COMM=useradd","-r","-n","1","--output-fields=MESSAGE", "-S","yesterday"], capture_output=True).stdout.decode('UTF-8') +last_user_added = subprocess.run(["sudo", "journalctl","_COMM=useradd","-r","-n", "1" , "--output-fields=MESSAGE"], capture_output=True).stdout.decode('UTF-8') +users_created_today = subprocess.run(["sudo", "journalctl", "-S","today","_COMM=useradd","-r","-n","1","--output-fields=MESSAGE"], capture_output=True).stdout.decode('UTF-8') +list_active_services = subprocess.run(["sudo", "service", "--status-all"], capture_output=True).stdout.decode('UTF-8') +list_groups = subprocess.run(["getent","group"], capture_output=True).stdout.decode('UTF-8') +since_last_boot = subprocess.run(["uptime","-s"], capture_output=True).stdout.decode('UTF-8') +list_package_installs = subprocess.run(["grep", 'install', "/var/log/dpkg.log"], capture_output=True).stdout.decode('UTF-8') +list_package_upgrade = subprocess.run(["grep", 'upgrade', "/var/log/dpkg.log"], capture_output=True).stdout.decode('UTF-8') +list_package_remove = subprocess.run(["grep", 'remove', "/var/log/dpkg.log"], capture_output=True).stdout.decode('UTF-8') +device_info_grab = subprocess.run(["grep", 'Model' , "/proc/cpuinfo"], check=True, capture_output=True) +device_info = subprocess.run(['awk', '-F:', '{ print $2}'], input=device_info_grab.stdout, capture_output=True).stdout.decode('utf-8').strip() +debian_version = subprocess.run(["cat", "/etc/debian_version"], capture_output=True).stdout.decode('UTF-8') +kernel_version = subprocess.run(["uname","-a"], capture_output=True).stdout.decode('UTF-8') +hostname = subprocess.run(["hostname","-i"], capture_output=True).stdout.decode('UTF-8') +# loading the environment +env = Environment(loader=FileSystemLoader("templates")) -# #subprocess.run(["ls", "-l"]) -# #print(os.popen("ls -l").read()) -# uptime = subprocess.run(["uptime", "-p"], capture_output=True) -# #print(thing.stdout) -# last_here = subprocess.run(["last", "-s", "today"], capture_output=True) -# ## Creating the HTML - -# # loading the environment -env = Environment(loader = FileSystemLoader('templates')) - # # loading the template -template = env.get_template('template.jinja') - +template = env.get_template("template.jinja") + # rendering the template and storing the resultant text in variable output -output = template.render(last_user_added = last_user_added.stdout, users_created_today=users_created_today.stdout) - -# # printing the output on screen -# print(output) -with open("output.html", 'w') as f: - print(output, file = f) +output = template.render( + last_user_added=last_user_added, + users_created_today=users_created_today, + list_active_services=list_active_services, + list_groups=list_groups, + since_last_boot=since_last_boot, + list_package_installs=list_package_installs, + list_package_upgrade=list_package_upgrade, + list_package_remove=list_package_remove, + device_info=device_info, + debian_version=debian_version, + kernel_version=kernel_version, + hostname=hostname +) + + +with open("output.html", "w") as f: + print(output, file=f) diff --git a/style.css b/style.css index 2a1f431..8546faf 100644 --- a/style.css +++ b/style.css @@ -145,7 +145,7 @@ nav label { overflow: hidden; display: inline-block; clear:both; - transition: .2s linear max-height; + transition: 0.2s linear max-height; font-family: CascadiaCode VTT, monospace; font-size: 14px; padding: 0px 2px; diff --git a/templates/template.jinja b/templates/template.jinja index c5dac66..298d8a6 100644 --- a/templates/template.jinja +++ b/templates/template.jinja @@ -1,15 +1,173 @@ + - - - Document + + + + + + + + + + + + + + + + + + Document + + -

I am a HTML page fillllllled with data, such as the {{ uptime }}

-

Or say something about who was here?

-
{{ users_created_today }}
-
{{ last_user_added }}
+
+

TL;DR

+

too log didn't read

+
+ + + +
+
+
+
+
+

What happened today?

+
last_user_added
+

{{last_user_added}} + {% if last_user_added is defined %} + + A level 1 annotation for last_user_added + + {% else %} + (no input) + {% endif %} + +

users_created_today
+

{{users_created_today}} + {% if users_created_today is defined %} + + A level 1 annotation for users_created_today + + {% else %} + (no input) + {% endif %} + +

list_active_services
+

{{list_active_services}} + {% if list_active_services is defined %} + + A level 1 annotation for list_active_services + + {% else %} + (no input) + {% endif %} + +

list_groups
+

{{list_groups}} + {% if list_groups is defined %} + + A level 1 annotation for list_groups + + {% else %} + (no input) + {% endif %} + +

since_last_boot
+

{{since_last_boot}} + {% if since_last_boot is defined %} + + A level 1 annotation for since_last_boot + + {% else %} + (no input) + {% endif %} + +

list_package_installs
+

{{list_package_installs}} + {% if list_package_installs is defined %} + + A level 1 annotation for list_package_installs + + {% else %} + (no input) + {% endif %} + +

list_package_upgrade
+

{{list_package_upgrade}} + {% if list_package_upgrade is defined %} + + A level 1 annotation for list_package_upgrade + + {% else %} + (no input) + {% endif %} + +

list_package_remove
+

{{list_package_remove}} + {% if list_package_remove is defined %} + + A level 1 annotation for list_package_remove + + {% else %} + (no input) + {% endif %} + +

device_info
+

{{device_info}} + {% if device_info is defined %} + + A level 1 annotation for device_info + + {% else %} + (no input) + {% endif %} + +

debian_version
+

{{debian_version}} + {% if debian_version is defined %} + + A level 1 annotation for debian_version + + {% else %} + (no input) + {% endif %} + +

kernel_version
+

{{kernel_version}} + {% if kernel_version is defined %} + + A level 1 annotation for kernel_version + + {% else %} + (no input) + {% endif %} + +

+
+ + + + + + + - + + \ No newline at end of file