-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall-log-encryption.sh
More file actions
executable file
Β·130 lines (103 loc) Β· 4.59 KB
/
install-log-encryption.sh
File metadata and controls
executable file
Β·130 lines (103 loc) Β· 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
#############################################################################
# NULLSEC LINUX - LOG ENCRYPTION INSTALLER v1.1 #
# Repository: https://github.com/bad-antics/nullsec #
#############################################################################
# Installs log encryption utility and dependencies
#############################################################################
set -e
CYAN='\033[0;36m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${CYAN}"
cat << "EOF"
====
| NULLSEC LINUX - LOG ENCRYPTION INSTALLER |
====
EOF
echo -e "${NC}"
echo -e "${GREEN}[+] Installing log encryption system...${NC}"
# Install Python dependencies
echo -e "${YELLOW}[*] Installing Python cryptography library...${NC}"
pip3 install --user cryptography 2>/dev/null || \
sudo pip3 install cryptography || \
python3 -m pip install --user cryptography
if [ $? -eq 0 ]; then
echo -e "${GREEN}[β] Cryptography library installed${NC}"
else
echo -e "${RED}[β] Failed to install cryptography library${NC}"
echo -e "${YELLOW}[*] Try: sudo apt-get install python3-cryptography${NC}"
exit 1
fi
# Make log-encrypt.py executable
echo -e "${YELLOW}[*] Setting permissions...${NC}"
chmod +x ~/nullsec/log-encrypt.py
# Create encryption key directory
mkdir -p ~/.nullsec
chmod 700 ~/.nullsec
# Generate initial encryption key
echo -e "${YELLOW}[*] Generating encryption key...${NC}"
echo -e "${CYAN}You will be asked to create a password for log encryption.${NC}"
echo -e "${CYAN}This password will be required to decrypt logs later.${NC}\n"
python3 ~/nullsec/log-encrypt.py --generate-key
if [ $? -eq 0 ]; then
echo -e "\n${GREEN}[β] Encryption key generated${NC}"
else
echo -e "\n${YELLOW}[!] Key generation skipped or failed${NC}"
fi
# Create symlink for easy access
echo -e "${YELLOW}[*] Creating command alias...${NC}"
if ! grep -q "alias log-encrypt" ~/.bashrc; then
echo "" >> ~/.bashrc
echo "# NullSec Log Encryption" >> ~/.bashrc
echo "alias log-encrypt='python3 ~/nullsec/log-encrypt.py'" >> ~/.bashrc
echo -e "${GREEN}[β] Added 'log-encrypt' alias to ~/.bashrc${NC}"
else
echo -e "${BLUE}[*] Alias already exists${NC}"
fi
echo -e "\n${GREEN}"
cat << "EOF"
====
| β
INSTALLATION COMPLETE |
====
π LOG ENCRYPTION SYSTEM INSTALLED
π Features:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AES-256 encryption for log files
β Password-based key derivation (PBKDF2)
β Automatic encryption option in framework
β Standalone encryption/decryption tools
β Directory-wide encryption support
π§ Usage:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1. Encrypt a log file:
log-encrypt --encrypt /path/to/logfile.log
2. Decrypt a log file:
log-encrypt --decrypt /path/to/logfile.log.enc
3. Encrypt all logs in directory:
log-encrypt --encrypt-dir ~/nullsec/logs
4. In framework modules:
When asked "Encrypt logs after execution? [y/N]:"
Answer 'y' to automatically encrypt
5. Generate new key:
log-encrypt --generate-key
π Files:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β’ ~/nullsec/log-encrypt.py - Main encryption utility
β’ ~/.nullsec/encryption.key - Your encryption key
β’ ~/.nullsec/encryption.salt - Salt for key derivation
β οΈ IMPORTANT:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β’ Keep your password safe - it cannot be recovered!
β’ Backup ~/.nullsec/ directory for key recovery
β’ Encrypted logs cannot be decrypted without the password
π Next Steps:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1. Reload bashrc: source ~/.bashrc
2. Test encryption: log-encrypt --help
3. Enable in framework when running modules
EOF
echo -e "${NC}"
exit 0