Compare commits

...

47 Commits

Author SHA1 Message Date
Bandie 8b6047ad83 Contribution :3 2026-03-17 19:38:58 +01:00
Bandie 36d49ac5cb Korhast contribution :3 2026-03-17 19:37:43 +01:00
Bandie 43dea64ea8 Proof-read translation by Korasten 2026-03-17 19:33:19 +01:00
Bandie 87a25c6033 6 vergessen 2026-03-16 20:53:32 +01:00
Bandie fb6d41b336 Formänderungen; Übersetzung der Verwaltungsvorschrift ins Englische 2026-03-16 19:18:39 +01:00
Raelis 4dbfdd2c73 Formblatt 2&3 erstellt, PDFs erzeugt 2026-03-16 18:33:20 +01:00
Raelis 40a2dfc825 Formblatt 1 ergänzt, PDFs erzeugt 2026-03-16 18:32:28 +01:00
Bandie 9bed4d289e C3Gov-Verwaltungsvorschrift 2. Fassung 2026-03-11 00:36:31 +01:00
Bandie d968c7dd02 more doc 2026-03-09 19:43:47 +01:00
Bandie 267c7c8e8f New documents 2026-03-09 19:42:18 +01:00
Bandie 59f7881519 glossy fix; removed old start 2026-03-07 17:48:19 +01:00
Bandie 5a6e96970d Version bump 2026-03-07 17:01:46 +01:00
Bandie f1216d564c HiP7 2026-03-07 17:00:13 +01:00
Bandie f89d5248f3 Glossy passport variant 2026-03-07 16:57:15 +01:00
Bandie ea4760a81e Ask for securing the passport 2025-12-07 21:39:45 +01:00
Bandie 35dd865b80 SecuritySticker-Support; docs and logo 2025-12-07 21:08:09 +01:00
Bandie fea4680642 security sticker™ 2025-12-07 19:16:46 +01:00
Bandie 9ca4126e8a being -> entity 2025-11-30 00:24:33 +01:00
Bandie 19af6dbce4 Password adding 2025-11-29 18:37:18 +01:00
Bandie b85f1d2e83 Installation 2025-11-29 17:45:41 +01:00
Bandie 95f349fd85 More documentation 2025-11-29 16:58:20 +01:00
Bandie 58c82fa9fc Stapled Passport - GPG next-page fix 2025-11-29 01:08:31 +01:00
Bandie 216e698f4e Bugfix 2025-11-28 23:14:22 +01:00
Bandie 6cb3c5eeb4 export into config 2025-11-28 22:37:29 +01:00
Bandie 6efac21a22 c3reg -> c3gov 2025-11-28 21:07:56 +01:00
Bandie 6a1591030d List ordering changed due to abandonment of adafruit 2025-11-28 19:41:13 +01:00
Bandie daf71a9fed changed size; changed title 2025-11-28 19:01:38 +01:00
Bandie 09d35810c0 More renaming; more client infos; documentation 2025-11-28 18:51:07 +01:00
Bandie f9ac98d829 Renaming c3Reg -> c3gov 2025-11-28 18:13:43 +01:00
Bandie e2151345d7 Typo: C3Reg-> c3Reg 2021-01-10 16:39:06 +01:00
Bandie 8dbc8c6605 C3Reg-Renaming; adding devtal's passport 2021-01-05 19:27:13 +01:00
Bandie e675a78b10 Document: Renaming to C3Reg 2021-01-05 18:59:43 +01:00
Bandie 333d5c9e3c Fix: GPG-Search 2021-01-04 22:04:43 +01:00
Bandie 7bb30f09f5 Check for empty string 2021-01-04 20:36:16 +01:00
Bandie 36eb4564a3 Y42: Extract the GPG part to another form 2021-01-04 20:33:52 +01:00
Bandie 4468db389f "Press enter" for first connect 2021-01-02 19:41:29 +01:00
Bandie 414ff4a546 Documents and applications 2020-12-28 19:39:06 +01:00
Bandie f1b804d0ee dialog is not compatible with VT52, beginning to rewrite UI 2020-11-22 19:30:29 +01:00
Bandie cad7fb1649 Surename->Surname 2020-10-31 23:22:29 +01:00
Bandie 1d71a42d3c dialog can now be black/white, lockfile, cheap password protection 2020-10-30 18:40:33 +01:00
Bandie 4a637a9b39 Galactic -> Intergalactic 2020-06-14 14:12:45 +02:00
Bandie 9599d9370c Want yours to be supported? 2020-06-14 14:11:34 +02:00
Bandie 24979969b6 jhp: Intergal. Reg. Office 2020-06-13 21:39:15 +02:00
Bandie 80e0d2ee9c GPG search (usage of keys.openpgp.org), deleting keys after getting FP, removing code duplication, corrected layout for jhp 2020-06-13 15:22:26 +02:00
Bandie dfd9cda104 Adafruit 2020-06-11 17:55:15 +02:00
Bandie d2a2c43386 Adafruit added 2020-06-11 17:54:10 +02:00
Bandie f98164f8e6 Missing FILE 2020-06-11 15:20:25 +02:00
52 changed files with 1859 additions and 311 deletions
+4
View File
@@ -0,0 +1,4 @@
# IRO's insecure passwords
- Filename: username
- File's content: password, plain text!
+63 -4
View File
@@ -1,10 +1,69 @@
# Galactic Registration Office
# c3gov
Fill out your hacker passport using a professional dot matrix printer.
## Supported Passports
## How to use the official® setup
### Start up
1. Plugin the Raspberry Pi.
2. Mind the following order:
1. Insert the RS232 adapter for the client(s) and connect them.
2. As the last device insert the RS232 adapter for the printer.
3. Turn on the printer.
### If the interface freezes
1. Turn off the printer.
2. Unplug the RS232 adapter from the Raspberry Pi.
3. Replug all RS232 in the order like described above.
### Turning off
1. Turn off the computer.
2. Unplug the RS232 adapter from the Raspberry Pi.
3. Turn off the Raspberry Pi.
## General information
### Configuration
See the `./config` file to set the client number and the event name.
### Hardware Requirements
- Wincor Nixdorf HighPrint 4915
- Raspberry Pi
- 3x - 5x USB RS232 adapter (male -> USB)
- 1x for printer
- 4x for two clients (2x each client)
- 2x RS232 connector (female -> female)
- 2x old laptops with some debian without GUI, only tty.
### Software Requirements
For the clients:
- screen
For the Raspberry Pi
- dialog
### Supported Passports
The following passports are supported atm:
- CmS Junghackerpass
- Bound Diplomatic passport by Mitch Altman (TVBGone) Matthew Borgatti (har.ms)
- Stapled Diplomatic passport Mitch/Matthew and Nils-Arne Pohlandt (devtal.de)
Do you want yours to be supported, too?
Talk to me and send me 3 example pieces. :)
## Set event name
To set the event name, just change the `EVENT` variable in `./start` at the top.
### Installation
1. Be root.
2. `cd /root`
3. `git clone https://git.chaospott.de/Bandie/c3gov`
4. `cd c3gov`
5. `cp -r etc/systemd/system/* /etc/systemd/system`
6. `systemctl enable --now getty@ttyUSB0`
7. `systemctl enable --now getty@ttyUSB1` (if there's will be a second client)
8. Add a user in .pw: `echo "password" > .pw/username`
## Contribution
Thank you
- Raelis, for helping me to add more application forms!
- Korhast, for proof-reading the English translation of the C3GovVerV!
+108
View File
@@ -0,0 +1,108 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=1
LEFT=5
# Additional heading space
HEADINGNEXTPAGE=19
HEADINGLEFT=1
HEADINGRIGHT=10
# GPG Space
NEXTPAGE=34
NEXTPAGESMALL=60
NEXTFIELDBOTTOM=13
NEXTFIELDRIGHT=18
NEXTFIELDRIGHTSMALL=30
if [ $# -eq 0 ]; then
echo -e "$0: Syntax:\n$0 FIELD\n\nExample:\n$0 7\n\n\nFields:
==================
| VISAS || VISAS |
==================
| 0 | 1 || 4 | 5 |
|---|---||---|---|
| 2 | 3 || 6 | 7 |
==================
"
exit 1
fi
PAGE=$(($1 / 4))
FIELD=$(($1 % 4))
shift 1
echo "PAGE: $PAGE, FIELD: $FIELD"
function moveDown() {
for((i=0; i<$(($FIELD / 2)); i++)); do
for((j=0; j<$NEXTFIELDBOTTOM; j++)); do
printf "\n" >> $FILE
done
done
}
function heading() {
moveDown
if [ $(($FIELD % 2)) -eq 0 ]; then
HSPACE=$HEADINGLEFT
SPACE=0
else
HSPACE=$HEADINGRIGHT
SPACE=$NEXTFIELDRIGHT
fi
bigLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $HEADINGNEXTPAGE $FILE
if [ $(($FIELD % 2)) -eq 1 ]; then
makeLeft $(($HSPACE - 1)) $FILE
fi
else
makeLeft 1 $FILE
makeLeft $HSPACE $FILE
fi
printf "c3gov\n" >> $FILE
resetLetters $FILE
}
function insertDate() {
if [ $(($FIELD % 2 )) -eq 0 ]; then
SPACE=0
else
SPACE=$NEXTFIELDRIGHTSMALL
fi
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGESMALL $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
if [ -n "$EVENT" ]; then
printf "$EVENT, $(date -I)" >> $FILE
else
printf "$(date -I)" >> $FILE
fi
}
source ../include/nixdorf
init
makeNewline $TOP $FILE
heading
insertDate
printFile $FILE
rm $FILE
+134
View File
@@ -0,0 +1,134 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=1
LEFT=3
# Additional heading space
HEADINGNEXTPAGE=36
HEADINGLEFT=1
HEADINGRIGHT=20
# GPG Space
NEXTPAGE=62
NEXTFIELDBOTTOM=11
NEXTFIELDRIGHT=31
MAXLENGTH=22
if [ $# -eq 0 ]; then
echo -e "$0: Syntax:\n$0 FIELD GPG FINGERPRINT WITH SPACES\n\nExample:\n$0 7 1234 5678 1234 1234 1234 1234 1234 1234 1234 ABCD\n\n\nFields:
==================
| VISAS || VISAS |
==================
| 0 | 1 || 4 | 5 |
|---|---||---|---|
| 2 | 3 || 6 | 7 |
==================
"
exit 1
fi
PAGE=$(($1 / 4))
FIELD=$(($1 % 4))
shift 1
echo "PAGE: $PAGE, FIELD: $FIELD"
function moveDown() {
for((i=0; i<$(($FIELD / 2)); i++)); do
for((j=0; j<$NEXTFIELDBOTTOM; j++)); do
printf "\n" >> $FILE
done
done
}
function heading() {
moveDown
if [ $(($FIELD % 2)) -eq 0 ]; then
SPACE=$HEADINGLEFT
else
SPACE=$HEADINGRIGHT
fi
if [ $PAGE -eq 1 ]; then
makeLeft $HEADINGNEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $SPACE $FILE
bigLetters $FILE
printf "GPG" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
}
function insertFP() {
if [ $(($FIELD % 2 )) -eq 0 ]; then
SPACE=0
else
SPACE=$NEXTFIELDRIGHT
fi
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2 $3 $4" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
shift 4
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2 $3 $4" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
shift 4
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
shift 2
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
if [ -n "$EVENT" ]; then
printf "$EVENT, $(date -I)" >> $FILE
else
printf "$(date -I)" >> $FILE
fi
}
source ../include/nixdorf
init
makeNewline $TOP $FILE
heading
insertFP $@
printFile $FILE
rm $FILE
Executable
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=56
NEXTFIELD=5
LEFT=22
AUTHLEFT=66
DATELEFT=37
MAXLENGTH=17
GIVENNAME=$1
SURNAME=$2
HOME=$3
if [ ${#GIVENNAME} -gt $MAXLENGTH ] || [ ${#SURNAME} -gt $MAXLENGTH ] || [ ${#HOME} -gt $MAXLENGTH ]; then
echo "MAXLENGTH EXCEEDED."
exit 1
fi
source ../include/nixdorf
init
smallLetters $FILE
printf "\x1b\x33\x0e" >> $FILE
makeNewline $TOP $FILE
makeLeft $LEFT $FILE
printf "$GIVENNAME" >> $FILE
# Authority field
makeNewline 2 $FILE
makeLeft $AUTHLEFT $FILE
printf "c3gov" >> $FILE
makeNewline 3 $FILE
makeLeft $LEFT $FILE
printf "$SURNAME" >> $FILE
makeNewline $NEXTFIELD $FILE
makeLeft $LEFT $FILE
printf "$HOME" >> $FILE
makeNewline 4 $FILE
makeLeft $DATELEFT $FILE
if [ -n "$EVENT" ]; then
printf "/ $EVENT, $(date -I)" >> $FILE
else
printf "/ $(date -I)" >> $FILE
fi
printFile $FILE
rm $FILE
+2
View File
@@ -0,0 +1,2 @@
# Clients
For the clients using RS232 u need to configure the /etc/passwd to use the officerload script
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
clear
screen /dev/ttyUSB0
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
# Number of clients, maximum 2
CLIENTS=1
# Event name.
# Please leave the export be.
export EVENT="Hack im Pott 7"
+144
View File
@@ -0,0 +1,144 @@
#
# Run-time configuration file for dialog
#
# Automatically generated by "dialog --create-rc <file>"
#
#
# Types of values:
#
# Number - <number>
# String - "string"
# Boolean - <ON|OFF>
# Attribute - (foreground,background,highlight?,underline?,reverse?)
# Set aspect-ration.
aspect = 0
# Set separator (for multiple widgets output).
separate_widget = ""
# Set tab-length (for textbox tab-conversion).
tab_len = 0
# Make tab-traversal for checklist, etc., include the list.
visit_items = OFF
# Shadow dialog boxes? This also turns on color.
use_shadow = OFF
# Turn color support ON or OFF
use_colors = OFF
# Screen color
screen_color = (CYAN,BLUE,OFF)
# Shadow color
shadow_color = (BLACK,BLACK,ON)
# Dialog box color
dialog_color = (BLACK,WHITE,OFF)
# Dialog box title color
title_color = (BLUE,WHITE,OFF)
# Dialog box border color
border_color = (WHITE,WHITE,ON)
# Active button color
button_active_color = (WHITE,BLACK,ON)
# Inactive button color
button_inactive_color = dialog_color
# Active button key color
button_key_active_color = button_active_color
# Inactive button key color
button_key_inactive_color = (RED,WHITE,OFF)
# Active button label color
button_label_active_color = (YELLOW,BLUE,OFF)
# Inactive button label color
button_label_inactive_color = (BLACK,WHITE,ON)
# Input box color
inputbox_color = dialog_color
# Input box border color
inputbox_border_color = dialog_color
# Search box color
searchbox_color = dialog_color
# Search box title color
searchbox_title_color = title_color
# Search box border color
searchbox_border_color = border_color
# File position indicator color
position_indicator_color = title_color
# Menu box color
menubox_color = dialog_color
# Menu box border color
menubox_border_color = border_color
# Item color
item_color = dialog_color
# Selected item color
item_selected_color = button_active_color
# Tag color
tag_color = title_color
# Selected tag color
tag_selected_color = button_label_active_color
# Tag key color
tag_key_color = button_key_inactive_color
# Selected tag key color
tag_key_selected_color = (RED,BLUE,ON)
# Check box color
check_color = dialog_color
# Selected check box color
check_selected_color = button_active_color
# Up arrow color
uarrow_color = (GREEN,WHITE,ON)
# Down arrow color
darrow_color = uarrow_color
# Item help-text color
itemhelp_color = (WHITE,BLACK,OFF)
# Active form text color
form_active_text_color = button_active_color
# Form text color
form_text_color = (WHITE,CYAN,OFF)
# Readonly form item color
form_item_readonly_color = (CYAN,WHITE,OFF)
# Dialog box gauge color
gauge_color = title_color
# Dialog box border2 color
border2_color = dialog_color
# Input box border2 color
inputbox_border2_color = dialog_color
# Search box border2 color
searchbox_border2_color = dialog_color
# Menu box border2 color
menubox_border2_color = dialog_color
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

@@ -0,0 +1,8 @@
[Service]
Type=simple
ExecStart=
ExecStart=-/root/c3gov/start_dialog
StandardInput=tty
StandardOutput=tty
Restart=always
RestartSec=5
@@ -0,0 +1,8 @@
[Service]
Type=simple
ExecStart=
ExecStart=-/root/c3gov/start_dialog
StandardInput=tty
StandardOutput=tty
Restart=always
RestartSec=5
+4 -2
View File
@@ -1,12 +1,14 @@
#!/bin/bash
DEVICE=/dev/ttyUSB0
function init() {
stty -F $DEVICE 1:0:80000dbd:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
# \x1b\x47 - Double Strike
# \x1b\x78\x01 - Standard Letter Mode
# \x1b\x52\x02 - German
printf "\x1b\x47\x1b\x78\x01\x1b\x52\x02" >> "$DEVICE"
# \x1b\x33\x20 - 20/180 inch line spacing (standard)
printf "\x1b\x47\x1b\x78\x01\x1b\x52\x02\x1b\x33\x20" >> "$DEVICE"
}
+2 -17
View File
@@ -11,10 +11,9 @@ HEADINGRIGHT=8
# GPG Space
NEXTPAGE=30
NEXTPAGESMALL=48
NEXTFIELDBOTTOM=7
NEXTFIELDBOTTOM=6
NEXTFIELDRIGHT=14
NEXTFIELDRIGHTSMALL=25
MAXLENGTH=22
if [ $# -eq 0 ]; then
echo -e "$0: Syntax:\n$0 FIELD\n\nExample:\n$0 7\n\n\nFields:
@@ -61,20 +60,6 @@ function heading() {
fi
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE
fi
makeLeft 1 $FILE
makeLeft $SPACE $FILE
italicLetters $FILE
printf "INTERGALACTIC\n" >> $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE
fi
makeLeft 1 $FILE
makeLeft $SPACE $FILE
printf "REGISTRATION\n" >> $FILE
bigLetters $FILE
if [ $PAGE -eq 1 ]; then
@@ -88,7 +73,7 @@ function heading() {
fi
makeLeft $HSPACE $FILE
fi
printf "OFFICE\n" >> $FILE
printf "c3gov\n" >> $FILE
resetLetters $FILE
}
+2 -2
View File
@@ -10,7 +10,7 @@ HEADINGRIGHT=15
# GPG Space
NEXTPAGE=48
NEXTFIELDBOTTOM=7
NEXTFIELDBOTTOM=6
NEXTFIELDRIGHT=25
MAXLENGTH=22
@@ -100,7 +100,7 @@ function insertFP() {
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
-30
View File
@@ -1,30 +0,0 @@
#!/bin/bash
FILE=/tmp/$RANDOM
source ../include/nixdorf
init
echo "1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1" > $FILE
printFile $FILE
rm $FILE
+8 -2
View File
@@ -18,11 +18,17 @@ fi
source ../include/nixdorf
init
makeNewline $TOP $FILE
makeNewline 1 $FILE
makeLeft $(($LEFT + 12)) $FILE
smallLetters $FILE
printf "/ c3gov" >> $FILE
resetLetters $FILE
makeNewline $(($TOP - 1)) $FILE
makeLeft $LEFT $FILE
printf "$GIVENNAME" >> $FILE
makeNewline 4 $FILE
makeNewline 3 $FILE
makeLeft $LEFT $FILE
printf "$SURNAME" >> $FILE
Executable
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=5
TOP=13
TOP2=51
LEFT=23
VISAPAGES=2
if [ $# -eq 0 ]; then
echo "Syntax: $0 <SecurityNumber>"
exit 1
fi
sn=$1
source ../include/nixdorf
init
smallLetters $FILE
printf "\x1b\x33\x0e" >> $FILE
makeNewline $TOP $FILE
makeLeft $LEFT $FILE
printf "$sn" >> $FILE
makeNewline $(($TOP2 - $TOP)) $FILE
makeLeft $LEFT $FILE
printf "$sn" >> $FILE
resetLetters $FILE
echo "Only use the pages saying \"VISAs\" on top"
for (( i=1; i<=$VISAPAGES; i++)); do
read -s -p "Insert page $i of $VISAPAGES and press enter."
echo ""
printFile $FILE
done
rm $FILE
-1
View File
@@ -1 +0,0 @@
./JunghackerPass "Foobert" "van Barbert" "Erde / Earth" "37C3, $(date -I)"
+108
View File
@@ -0,0 +1,108 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=1
LEFT=5
# Additional heading space
HEADINGNEXTPAGE=19
HEADINGLEFT=1
HEADINGRIGHT=10
# GPG Space
NEXTPAGE=34
NEXTPAGESMALL=60
NEXTFIELDBOTTOM=13
NEXTFIELDRIGHT=18
NEXTFIELDRIGHTSMALL=30
if [ $# -eq 0 ]; then
echo -e "$0: Syntax:\n$0 FIELD\n\nExample:\n$0 7\n\n\nFields:
==================
| VISAS || VISAS |
==================
| 0 | 1 || 4 | 5 |
|---|---||---|---|
| 2 | 3 || 6 | 7 |
==================
"
exit 1
fi
PAGE=$(($1 / 4))
FIELD=$(($1 % 4))
shift 1
echo "PAGE: $PAGE, FIELD: $FIELD"
function moveDown() {
for((i=0; i<$(($FIELD / 2)); i++)); do
for((j=0; j<$NEXTFIELDBOTTOM; j++)); do
printf "\n" >> $FILE
done
done
}
function heading() {
moveDown
if [ $(($FIELD % 2)) -eq 0 ]; then
HSPACE=$HEADINGLEFT
SPACE=0
else
HSPACE=$HEADINGRIGHT
SPACE=$NEXTFIELDRIGHT
fi
bigLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $HEADINGNEXTPAGE $FILE
if [ $(($FIELD % 2)) -eq 1 ]; then
makeLeft $(($HSPACE - 1)) $FILE
fi
else
makeLeft 1 $FILE
makeLeft $HSPACE $FILE
fi
printf "c3gov\n" >> $FILE
resetLetters $FILE
}
function insertDate() {
if [ $(($FIELD % 2 )) -eq 0 ]; then
SPACE=0
else
SPACE=$NEXTFIELDRIGHTSMALL
fi
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGESMALL $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
if [ -n "$EVENT" ]; then
printf "$EVENT, $(date -I)" >> $FILE
else
printf "$(date -I)" >> $FILE
fi
}
source ../include/nixdorf
init
makeNewline $TOP $FILE
heading
insertDate
printFile $FILE
rm $FILE
+134
View File
@@ -0,0 +1,134 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=1
LEFT=3
# Additional heading space
HEADINGNEXTPAGE=36
HEADINGLEFT=1
HEADINGRIGHT=20
# GPG Space
NEXTPAGE=58
NEXTFIELDBOTTOM=11
NEXTFIELDRIGHT=31
MAXLENGTH=22
if [ $# -eq 0 ]; then
echo -e "$0: Syntax:\n$0 FIELD GPG FINGERPRINT WITH SPACES\n\nExample:\n$0 7 1234 5678 1234 1234 1234 1234 1234 1234 1234 ABCD\n\n\nFields:
==================
| VISAS || VISAS |
==================
| 0 | 1 || 4 | 5 |
|---|---||---|---|
| 2 | 3 || 6 | 7 |
==================
"
exit 1
fi
PAGE=$(($1 / 4))
FIELD=$(($1 % 4))
shift 1
echo "PAGE: $PAGE, FIELD: $FIELD"
function moveDown() {
for((i=0; i<$(($FIELD / 2)); i++)); do
for((j=0; j<$NEXTFIELDBOTTOM; j++)); do
printf "\n" >> $FILE
done
done
}
function heading() {
moveDown
if [ $(($FIELD % 2)) -eq 0 ]; then
SPACE=$HEADINGLEFT
else
SPACE=$HEADINGRIGHT
fi
if [ $PAGE -eq 1 ]; then
makeLeft $HEADINGNEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $SPACE $FILE
bigLetters $FILE
printf "GPG" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
}
function insertFP() {
if [ $(($FIELD % 2 )) -eq 0 ]; then
SPACE=0
else
SPACE=$NEXTFIELDRIGHT
fi
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2 $3 $4" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
shift 4
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2 $3 $4" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
shift 4
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
shift 2
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
if [ -n "$EVENT" ]; then
printf "$EVENT, $(date -I)" >> $FILE
else
printf "$(date -I)" >> $FILE
fi
}
source ../include/nixdorf
init
makeNewline $TOP $FILE
heading
insertFP $@
printFile $FILE
rm $FILE
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=56
NEXTFIELD=5
LEFT=23
AUTHLEFT=66
DATELEFT=35
MAXLENGTH=17
GIVENNAME=$1
SURNAME=$2
HOME=$3
if [ ${#GIVENNAME} -gt $MAXLENGTH ] || [ ${#SURNAME} -gt $MAXLENGTH ] || [ ${#HOME} -gt $MAXLENGTH ]; then
echo "MAXLENGTH EXCEEDED."
exit 1
fi
source ../include/nixdorf
init
smallLetters $FILE
printf "\x1b\x33\x0e" >> $FILE
makeNewline $TOP $FILE
makeLeft $LEFT $FILE
printf "$GIVENNAME" >> $FILE
# Authority field
makeNewline 2 $FILE
makeLeft $AUTHLEFT $FILE
printf "c3gov" >> $FILE
makeNewline 3 $FILE
makeLeft $LEFT $FILE
printf "$SURNAME" >> $FILE
makeNewline $NEXTFIELD $FILE
makeLeft $LEFT $FILE
printf "$HOME" >> $FILE
makeNewline 5 $FILE
makeLeft $DATELEFT $FILE
if [ -n "$EVENT" ]; then
printf "/ $EVENT, $(date -I)" >> $FILE
else
printf "/ $(date -I)" >> $FILE
fi
printFile $FILE
rm $FILE
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=0
LEFT=3
VISAPAGES=6
# GPG Space
NEXTPAGE=28
NEXTPAGESMALL=60
NEXTFIELDBOTTOM=13
NEXTFIELDRIGHT=18
NEXTFIELDRIGHTSMALL=30
if [ $# -eq 0 ]; then
echo "Syntax: $0 <SecurityNumber>"
exit 1
fi
sn=$1
source ../include/nixdorf
init
makeNewline $TOP $FILE
makeLeft $LEFT $FILE
italicLetters $FILE
printf "$sn" >> $FILE
makeLeft $NEXTPAGE $FILE
printf "$sn" >> $FILE
resetLetters $FILE
echo "Only use the pages saying \"VISAs\" on top"
for (( i=1; i<=$VISAPAGES; i++)); do
read -s -p "Insert page $i of $VISAPAGES and press enter."
echo ""
printFile $FILE
done
rm $FILE
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=52
NEXTFIELD=5
LEFT=38
MAXLENGTH=6
GIVENNAME=$1
SURNAME=$2
HOME=$3
if [ $# -eq 0 ]; then
echo "Syntax: $0 <SecurityNumber>"
exit 1
fi
sn=$1
if [ ${#sn} -gt $MAXLENGTH ]; then
echo "Security Number too long"
exit 1
fi
source ../include/nixdorf
init
smallLetters $FILE
printf "\x1b\x33\x0e" >> $FILE
makeNewline $TOP $FILE
makeLeft $LEFT $FILE
printf "$1" >> $FILE
printFile $FILE
rm $FILE
+108
View File
@@ -0,0 +1,108 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=1
LEFT=5
# Additional heading space
HEADINGNEXTPAGE=19
HEADINGLEFT=1
HEADINGRIGHT=10
# GPG Space
NEXTPAGE=34
NEXTPAGESMALL=60
NEXTFIELDBOTTOM=13
NEXTFIELDRIGHT=18
NEXTFIELDRIGHTSMALL=30
if [ $# -eq 0 ]; then
echo -e "$0: Syntax:\n$0 FIELD\n\nExample:\n$0 7\n\n\nFields:
==================
| VISAS || VISAS |
==================
| 0 | 1 || 4 | 5 |
|---|---||---|---|
| 2 | 3 || 6 | 7 |
==================
"
exit 1
fi
PAGE=$(($1 / 4))
FIELD=$(($1 % 4))
shift 1
echo "PAGE: $PAGE, FIELD: $FIELD"
function moveDown() {
for((i=0; i<$(($FIELD / 2)); i++)); do
for((j=0; j<$NEXTFIELDBOTTOM; j++)); do
printf "\n" >> $FILE
done
done
}
function heading() {
moveDown
if [ $(($FIELD % 2)) -eq 0 ]; then
HSPACE=$HEADINGLEFT
SPACE=0
else
HSPACE=$HEADINGRIGHT
SPACE=$NEXTFIELDRIGHT
fi
bigLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $HEADINGNEXTPAGE $FILE
if [ $(($FIELD % 2)) -eq 1 ]; then
makeLeft $(($HSPACE - 1)) $FILE
fi
else
makeLeft 1 $FILE
makeLeft $HSPACE $FILE
fi
printf "c3gov\n" >> $FILE
resetLetters $FILE
}
function insertDate() {
if [ $(($FIELD % 2 )) -eq 0 ]; then
SPACE=0
else
SPACE=$NEXTFIELDRIGHTSMALL
fi
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGESMALL $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
if [ -n "$EVENT" ]; then
printf "$EVENT, $(date -I)" >> $FILE
else
printf "$(date -I)" >> $FILE
fi
}
source ../include/nixdorf
init
makeNewline $TOP $FILE
heading
insertDate
printFile $FILE
rm $FILE
+134
View File
@@ -0,0 +1,134 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=1
LEFT=3
# Additional heading space
HEADINGNEXTPAGE=36
HEADINGLEFT=1
HEADINGRIGHT=20
# GPG Space
NEXTPAGE=58
NEXTFIELDBOTTOM=11
NEXTFIELDRIGHT=31
MAXLENGTH=22
if [ $# -eq 0 ]; then
echo -e "$0: Syntax:\n$0 FIELD GPG FINGERPRINT WITH SPACES\n\nExample:\n$0 7 1234 5678 1234 1234 1234 1234 1234 1234 1234 ABCD\n\n\nFields:
==================
| VISAS || VISAS |
==================
| 0 | 1 || 4 | 5 |
|---|---||---|---|
| 2 | 3 || 6 | 7 |
==================
"
exit 1
fi
PAGE=$(($1 / 4))
FIELD=$(($1 % 4))
shift 1
echo "PAGE: $PAGE, FIELD: $FIELD"
function moveDown() {
for((i=0; i<$(($FIELD / 2)); i++)); do
for((j=0; j<$NEXTFIELDBOTTOM; j++)); do
printf "\n" >> $FILE
done
done
}
function heading() {
moveDown
if [ $(($FIELD % 2)) -eq 0 ]; then
SPACE=$HEADINGLEFT
else
SPACE=$HEADINGRIGHT
fi
if [ $PAGE -eq 1 ]; then
makeLeft $HEADINGNEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $SPACE $FILE
bigLetters $FILE
printf "GPG" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
}
function insertFP() {
if [ $(($FIELD % 2 )) -eq 0 ]; then
SPACE=0
else
SPACE=$NEXTFIELDRIGHT
fi
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2 $3 $4" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
shift 4
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2 $3 $4" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
shift 4
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2" >> $FILE
resetLetters $FILE
printf "\n" >> $FILE
shift 2
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
if [ -n "$EVENT" ]; then
printf "$EVENT, $(date -I)" >> $FILE
else
printf "$(date -I)" >> $FILE
fi
}
source ../include/nixdorf
init
makeNewline $TOP $FILE
heading
insertFP $@
printFile $FILE
rm $FILE
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=54
NEXTFIELD=5
LEFT=23
AUTHLEFT=66
DATELEFT=35
MAXLENGTH=17
GIVENNAME=$1
SURNAME=$2
HOME=$3
if [ ${#GIVENNAME} -gt $MAXLENGTH ] || [ ${#SURNAME} -gt $MAXLENGTH ] || [ ${#HOME} -gt $MAXLENGTH ]; then
echo "MAXLENGTH EXCEEDED."
exit 1
fi
source ../include/nixdorf
init
smallLetters $FILE
printf "\x1b\x33\x0e" >> $FILE
makeNewline $TOP $FILE
makeLeft $LEFT $FILE
printf "$GIVENNAME" >> $FILE
# Authority field
makeNewline 2 $FILE
makeLeft $AUTHLEFT $FILE
printf "c3gov" >> $FILE
makeNewline 3 $FILE
makeLeft $LEFT $FILE
printf "$SURNAME" >> $FILE
makeNewline $NEXTFIELD $FILE
makeLeft $LEFT $FILE
printf "$HOME" >> $FILE
makeNewline 5 $FILE
makeLeft $DATELEFT $FILE
if [ -n "$EVENT" ]; then
printf "/ $EVENT, $(date -I)" >> $FILE
else
printf "/ $(date -I)" >> $FILE
fi
printFile $FILE
rm $FILE
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=0
LEFT=3
VISAPAGES=6
# GPG Space
NEXTPAGE=28
NEXTPAGESMALL=60
NEXTFIELDBOTTOM=13
NEXTFIELDRIGHT=18
NEXTFIELDRIGHTSMALL=30
if [ $# -eq 0 ]; then
echo "Syntax: $0 <SecurityNumber>"
exit 1
fi
sn=$1
source ../include/nixdorf
init
makeNewline $TOP $FILE
makeLeft $LEFT $FILE
italicLetters $FILE
printf "$sn" >> $FILE
makeLeft $NEXTPAGE $FILE
printf "$sn" >> $FILE
resetLetters $FILE
echo "Only use the pages saying \"VISAs\" on top"
for (( i=1; i<=$VISAPAGES; i++)); do
read -s -p "Insert page $i of $VISAPAGES and press enter."
echo ""
printFile $FILE
done
rm $FILE
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
FILE=/tmp/$RANDOM
TOP=50
NEXTFIELD=5
LEFT=38
MAXLENGTH=6
GIVENNAME=$1
SURNAME=$2
HOME=$3
if [ $# -eq 0 ]; then
echo "Syntax: $0 <SecurityNumber>"
exit 1
fi
sn=$1
if [ ${#sn} -gt $MAXLENGTH ]; then
echo "Security Number too long"
exit 1
fi
source ../include/nixdorf
init
smallLetters $FILE
printf "\x1b\x33\x0e" >> $FILE
makeNewline $TOP $FILE
makeLeft $LEFT $FILE
printf "$1" >> $FILE
printFile $FILE
rm $FILE
-253
View File
@@ -1,253 +0,0 @@
#!/bin/bash
export EVENT=DiVOC
TMP=/tmp/$RANDOM
BT="Intergalactic Registration Office - v0.1"
function diaBox() {
h=8
w=60
if [ -n "$3" ]; then
h=$3
fi
if [ -n "$4" ]; then
w=$4
fi
dialog --title "$1" \
--backtitle "$BT" \
--msgbox "$2" $h $w
}
function ynBox() {
h=8
w=60
if [ -n "$3" ]; then
h=$3
fi
if [ -n "$4" ]; then
w=$4
fi
dialog --title "$1" \
--backtitle "$BT" \
--yesno "$2" $h $w
return $?
}
function askStr() {
h=12
w=60
if [ -n "$5" ]; then
h=$5
fi
if [ -n "$6" ]; then
w=$6
fi
dialog --title "$2" \
--backtitle "$BT" \
--max-input $1 \
--inputbox "$3" $h $w "$4" 2> $TMP
return $?
}
function confirm() {
h=12
w=60
if [ -n "$3" ]; then
h=$3
fi
if [ -n "$4" ]; then
w=$4
fi
dialog --title "Confirm: $1" \
--backtitle "$BT" \
--yesno "Please confirm those information:\n$2" $h $w
return $?
}
function jhpAskForField() {
text="$1: Please choose a free field on the passport.\n
------------------\n
| Archievements |\n
==================\n
| 0 | 1 || 6 | 7 |\n
|---|---||---|---|\n
| 2 | 3 || 8 | 9 |\n
|---|---||---|---|\n
| 4 | 5 || 10| 11|\n
==================\n
"
askStr 2 "Select a field" "$text" "" 18
if [ $? -eq 1 ]; then
return 1
fi
FIELD=$(cat $TMP)
if ! [[ "$FIELD" =~ ^[0-9]+$ ]] || [ -z "$FIELD" ] || [ $FIELD -lt 0 ] || [ $FIELD -gt 11 ]; then
jhpAskForField
else
return 0
fi
}
function jhpPrintGPG() {
jhpAskForField "GPG fingerprint"
if [ $? -eq 0 ]; then
diaBox "Insert Passport" "Please insert passport (Archivements) into the printer."
cd jhp
./gpgkey $FIELD $FP
cd ..
return 0
else
return 1
fi
}
function jhpPrintReg() {
diaBox "Insert Passport" "Please insert passport (First page, name, planet, date) into the printer."
cd jhp
./JunghackerPass "$FNAME" "$SNAME" "$PLANET"
cd ..
return 0
}
function jhpIROStamp() {
jhpAskForField "IRO stamp"
if [ $? -eq 0 ]; then
diaBox "Insert Passport" "Please insert passport (Archivements) into the printer."
cd jhp
./iro $FIELD
cd ..
return 0
else
return 1
fi
}
function jhpGPG() {
askStr 49 "GPG Fingerprint" "Enter GPG fingerprint WITH SPACES. E.g.:\n 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678"
if [ $? -eq 0 ]; then
FP=$(cat $TMP)
rm $TMP
if ! [[ $FP =~ ^([[:xdigit:]]{4} ){9}[[:xdigit:]]{4}$ ]]; then
diaBox "GPG Fingerprint" "This does not match the RegEx of a GPG fingerprint.\nPlease type in the whole fingerprint."
jhpGPG
fi
FP=$(echo "$FP" | tr [a-f] [A-F])
else
return 1
fi
if [ "$1" == "no-confirm" ]; then
return 0
else
confirm "GPG Fingerprint" " GPG:\n $FP"
return $?
fi
}
function jhpReg() {
askStr 25 "Forename/Nickname" "Enter forename/nickname"
if [ $? -eq 1 ]; then
return 1
fi
FNAME=$(cat $TMP)
askStr 25 "Surename" "Enter surename"
if [ $? -eq 1 ]; then
return 1
fi
SNAME=$(cat $TMP)
askStr 25 "Planet" "Enter planet" "Earth, Chaospott"
if [ $? -eq 1 ]; then
return 1
fi
PLANET=$(cat $TMP)
confirm=" Forename: $FNAME\n Surename: $SNAME\n Planet: $PLANET"
ynBox "IRO Stamp" "Does this being want to have a IRO stamp?"
if [ $? -eq 0 ]; then
STAMP=true
else
STAMP=false
fi
ynBox "GPG" "Does the being have a GPG key to register?"
if [ $? -eq 0 ]; then
jhpGPG no-confirm
if [ $? -eq 0 ]; then
confirm="$confirm\n GPG:\n $FP"
fi
fi
confirm "Everything" "$confirm"
return $?
}
function jhpmenu() {
dialog --backtitle "$BT" \
--menu "Select ID type:" 14 40 3 \
1 "Registration" \
2 "IRO Stamp" \
3 "GPG" \
9 "Back" 2> $TMP
choice=$(cat $TMP)
case $choice in
1) jhpReg
if [ $? -eq 0 ]; then
jhpPrintReg
if [ "$STAMP" == "true" ]; then
jhpIROStamp
fi
if [ -n "$FP" ]; then
jhpPrintGPG
fi
fi
;;
2) jhpIROStamp
;;
3) jhpGPG
if [ $? -eq 0 ]; then
jhpPrintGPG
fi
;;
esac
unset FNAME
unset SNAME
unset PLANET
unset FP
unset FIELD
}
while [ true ]; do
dialog --backtitle "$BT" \
--menu "Select ID type:" 10 40 3 \
1 "Junghackerpass" \
2 "Usual" 2> $TMP
if [ $? -eq 1 ]; then
break
fi
TYPE=$(cat $TMP)
case $TYPE in
1) jhpmenu
;;
2) exit 0
;;
esac
done
rm $TMP
clear
Executable
+513
View File
@@ -0,0 +1,513 @@
#!/bin/bash
export LANG=C
export TERM=vt220
export DIALOGRC=dialogrc
source $(dirname $0)/config
export PRINTDEVICE="/dev/ttyUSB$CLIENTS"
export DEVICE="$PRINTDEVICE"
LOCKFILE=/tmp/c3govlock
TMP=/tmp/$RANDOM
BT="c3gov - v0.5.1.2"
cd $(dirname "$0")
function infoBox() {
h=8
w=60
if [ -n "$3" ]; then
h=$3
fi
if [ -n "$4" ]; then
w=$4
fi
dialog --title "$1" \
--backtitle "$BT" \
--infobox "$2" $h $w
}
function diaBox() {
h=8
w=60
if [ -n "$3" ]; then
h=$3
fi
if [ -n "$4" ]; then
w=$4
fi
dialog --title "$1" \
--backtitle "$BT" \
--msgbox "$2" $h $w
}
function ynBox() {
h=8
w=60
if [ -n "$3" ]; then
h=$3
fi
if [ -n "$4" ]; then
w=$4
fi
dialog --title "$1" \
--backtitle "$BT" \
--yesno "$2" $h $w
return $?
}
function askStr() {
h=12
w=60
if [ -n "$5" ]; then
h=$5
fi
if [ -n "$6" ]; then
w=$6
fi
dialog --title "$2" \
--backtitle "$BT" \
--max-input $1 \
--inputbox "$3" $h $w "$4" 2> $TMP
return $?
}
function askPw() {
h=12
w=60
if [ -n "$5" ]; then
h=$5
fi
if [ -n "$6" ]; then
w=$6
fi
dialog --title "$2" \
--backtitle "$BT" \
--max-input $1 \
--insecure \
--passwordbox "$3" $h $w "$4" 2> $TMP
return $?
}
function confirm() {
h=12
w=60
if [ -n "$3" ]; then
h=$3
fi
if [ -n "$4" ]; then
w=$4
fi
dialog --title "Confirm: $1" \
--backtitle "$BT" \
--yesno "Please confirm those information:\n$2" $h $w
return $?
}
function askStrThird() {
h=12
w=60
if [ -n "$6" ]; then
h=$5
fi
if [ -n "$7" ]; then
w=$6
fi
dialog --backtitle "$BT" \
--max-input $1 \
--title "$2" \
--extra-button --extra-label "$4" \
--inputbox "$3" $h $w "$5" 2> $TMP
return $?
}
function gpgSearch() {
askStr 255 "GPG Search" "Type in the mail address you'd like to look up on keys.openpgp.org."
if [ $? -eq 0 ]; then
if [[ "$(cat $TMP)" =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$ ]]; then
clear
echo "Searching for GPG key..."
gpg --keyserver "hkps://keys.openpgp.org" --search "$(cat $TMP)"
if [ $? -eq 0 ]; then
FFP=$(gpg -k "$(cat $TMP)" | head -n 2 | tail -n 1 | awk '{print $1}' | sed 's/.\{4\}/& /g;s/^\(.*\) $/\1/g')
gpg --batch --delete-key "$FFP"
if [ "$FFP" = "" ]; then
diaBox "GPG Search" "No fingerprint has been found for $(cat $TMP)"
return 1
else
return 0
fi
else
diaBox "GPG Search" "No fingerprint has been found for $(cat $TMP)"
return 1
fi
else
diaBox "GPG Search" "This is on vaild mail address."
return 1
fi
fi
return 1
}
function enterGPG() {
askStrThird 49 "GPG Fingerprint" "Enter GPG fingerprint WITH SPACES. E.g.:\n 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678" "Search..." "$1"
ret=$?
case $ret in
0)
FP=$(cat $TMP)
rm $TMP
if ! [[ $FP =~ ^([[:xdigit:]]{4} ){9}[[:xdigit:]]{4}$ ]]; then
diaBox "GPG Fingerprint" "This does not match the RegEx of a GPG fingerprint.\nPlease type in the whole fingerprint."
enterGPG
fi
FP=$(echo "$FP" | tr [a-f] [A-F])
;;
1)
return 1
;;
3)
gpgSearch
if [ $? -eq 0 ]; then
enterGPG "$FFP" "no-confirm"
return 0
else
return 1
fi
;;
esac
if [ "$2" == "no-confirm" ]; then
return 0
else
confirm "GPG Fingerprint" " GPG:\n $FP"
return $?
fi
}
function checkLockFile() {
while [ -f $LOCKFILE ]; do
infoBox "Printer is in use..." "Printer is in use. Please wait."
sleep 1
done
touch $LOCKFILE
}
function printGPG() {
askForField "GPG fingerprint" "$1"
if [ $? -eq 0 ]; then
checkLockFile
diaBox "Insert Passport" "Please insert passport (Visas) into the printer."
cd "$1"
./gpgkey $FIELD $FP
cd ..
rm $LOCKFILE
return 0
else
return 1
fi
}
function printReg() {
checkLockFile
diaBox "Insert Passport" "Please insert passport (First page, name, place) into the printer."
cd "$1"
./reg "$FNAME" "$SNAME" "$PLANET"
cd ..
rm $LOCKFILE
return 0
}
function printc3govStamp() {
askForField "c3gov stamp" "$1"
if [ $? -eq 0 ]; then
checkLockFile
diaBox "Insert Passport" "Please insert passport (Visas) into the printer."
cd "$1"
./c3gov $FIELD
cd ..
rm $LOCKFILE
return 0
else
return 1
fi
}
function askForField() {
declare -A layout
declare -A maxfield
text="$1: Please choose a free field on the passport.\n"
layout[jhp]="
------------------\n
| Archievements |\n
==================\n
| 0 | 1 || 6 | 7 |\n
|---|---||---|---|\n
| 2 | 3 || 8 | 9 |\n
|---|---||---|---|\n
| 4 | 5 || 10| 11|\n
==================\n
"
layout[bounddipl]="
------------------\n
| VISAS || VISAS |\n
==================\n
| 0 | 1 || 4 | 5 |\n
|---|---||---|---|\n
| 2 | 3 || 6 | 7 |\n
==================\n
"
layout[stapleddipl]="
------------------\n
| VISAS || VISAS |\n
==================\n
| 0 | 1 || 4 | 5 |\n
|---|---||---|---|\n
| 2 | 3 || 6 | 7 |\n
==================\n
"
maxfield[jhp]=11
maxfield[bounddipl]=7
maxfield[stapleddipl]=7
askStr 2 "Select a field" "$text ${layout[$2]}" "" 18
if [ $? -eq 1 ]; then
return 1
fi
FIELD=$(cat $TMP)
if ! [[ "$FIELD" =~ ^[0-9]+$ ]] || [ -z "$FIELD" ] || [ $FIELD -lt 0 ] || [ $FIELD -gt ${maxfield[$2]} ]; then
askForField "$1" "$2"
else
return 0
fi
}
function askReg() {
# Max length of passport fields
declare -A MAXLENGTH
MAXLENGTH[jhp]=25
MAXLENGTH[bounddipl]=17
MAXLENGTH[stapleddipl]=17
MAXLENGTH[stapled_glossy_dipl]=17
askStr ${MAXLENGTH[$1]} "Forename/Nickname" "Enter forename/nickname"
if [ $? -eq 1 ]; then
return 1
fi
FNAME=$(cat $TMP)
askStr ${MAXLENGTH[$1]} "Surname" "Enter surname"
if [ $? -eq 1 ]; then
return 1
fi
SNAME=$(cat $TMP)
askStr ${MAXLENGTH[$1]} "Place" "Enter place"
if [ $? -eq 1 ]; then
return 1
fi
PLANET=$(cat $TMP)
confirm=" Forename: $FNAME\n Surname: $SNAME\n Place: $PLANET"
ynBox "Security" "Secure this passport using security stickers?"
if [ $? -eq 0 ]; then
SECURE=true
else
SECURE=false
fi
ynBox "c3gov Stamp" "Does this entity want to have a c3gov stamp?"
if [ $? -eq 0 ]; then
STAMP=true
else
STAMP=false
fi
ynBox "GPG" "Does the entity have a GPG key to register?"
if [ $? -eq 0 ]; then
enterGPG "" no-confirm
if [ $? -eq 0 ]; then
confirm="$confirm\n GPG:\n $FP"
fi
fi
confirm "Everything" "$confirm"
return $?
}
function enterSecurityCode() {
MAXLENGTH=6
askStr ${MAXLENGTH} "Security code" "Enter security code from the security sticker (e.g. S12345)."
if [ $? -eq 1 ]; then
return 1
fi
SECURITYCODE=$(cat $TMP)
confirm "Security code" "Security code: $SECURITYCODE"
return $?
}
function printSecurePassportFirstPage(){
checkLockFile
diaBox "Insert Passport" "Pleast insert the FIRST PAGE (Identity) into the printer."
cd "$1"
./secure_firstpage "$SECURITYCODE"
cd ..
rm $LOCKFILE
}
function printSecurePassport(){
checkLockFile
diaBox "Insert Passport" "Please insert passport (Visas) into the printer.\nA print on EVERY Visa page is necessary."
cd "$1"
./secure "$SECURITYCODE"
cd ..
rm $LOCKFILE
}
function enableSecurity() {
if [ "$1" = "bounddipl" ]; then
diaBox "Error" "Passport security: Passport not supported."
else
enterSecurityCode
if [ $? -eq 0 ]; then
case $1 in
"bounddipl")
;;
"jhp")
printSecurePassport "$1"
;;
*)
printSecurePassportFirstPage "$1"
printSecurePassport "$1"
;;
esac
fi
fi
}
function menuFor() {
dialog --backtitle "$BT" \
--menu "Select purpose:" 14 40 3 \
1 "Registration" \
2 "c3gov Stamp" \
3 "GPG" \
8 "Secure Passport" \
9 "Back" 2> $TMP
choice=$(cat $TMP)
case $choice in
1) askReg "$1"
if [ $? -eq 0 ]; then
printReg "$1"
if [ "$SECURE" = "true" ]; then
enableSecurity "$1"
fi
if [ "$STAMP" = "true" ]; then
printc3govStamp "$1"
fi
if [ -n "$FP" ]; then
printGPG "$1"
fi
fi
;;
2) printc3govStamp "$1"
;;
3) enterGPG
if [ $? -eq 0 ]; then
printGPG "$1"
fi
;;
8) enableSecurity "$1"
;;
esac
unset FNAME
unset SNAME
unset PLANET
unset FP
unset FIELD
unset FFP
unset SECURITYCODE
}
function askForFunnyUserCreds() {
clear
echo "Press Enter to start."
read -s
askStr 12 "Login" "Username:" ""
username=$(cat $TMP)
askPw 12 "Login" "Password:" ""
password=$(cat $TMP)
if [ -f ".pw/$username" ]; then
if [ "$password" != $(cat .pw/$username) ]; then
clear
echo "Wrong credentials."
sleep 3
exit 1
fi
else
echo "Wrong credentials."
sleep 3
exit 1
fi
}
askForFunnyUserCreds
while [ true ]; do
dialog --backtitle "$BT" \
--menu "Select ID type:" 12 40 3 \
1 "Stapled diplomatic passport" \
2 "Stapled glossy paper diplomatic passport" \
3 "Junghackerpass" \
4 "Bound diplomatic passport" \
9 "Logout" 2> $TMP
if [ $? -eq 9 ]; then
break
fi
TYPE=$(cat $TMP)
case $TYPE in
1) menuFor stapleddipl
;;
2) menuFor stapled_glossy_dipl
;;
3) menuFor jhp
;;
4) menuFor bounddipl
;;
9) break
;;
esac
done
rm $TMP
clear
Executable
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
FILE=/tmp/$RANDOM
source ../include/nixdorf
init
smallLetters $FILE
#printf "\x1b\x33\x0a" >> $FILE
printf "\x1b\x33\x0e" >> $FILE
#for j in $(seq 0 10); do
for i in $(seq 0 100); do
printf " $i\n" >> $FILE
done
#done
printFile $FILE
rm $FILE