Skip to content

Commit eafc131

Browse files
authored
Merge pull request #910 from six2dez/dev
Dev
2 parents c553637 + 221a049 commit eafc131

File tree

7 files changed

+4707
-2041
lines changed

7 files changed

+4707
-2041
lines changed

Proxmox/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# ReconFTW Proxmox LXC Deployment Script
2+
3+
This script automates the deployment of ReconFTW in a Linux Container (LXC) on a Proxmox server. It simplifies the process of setting up a dedicated environment for reconnaissance activities.
4+
5+
## Prerequisites
6+
7+
- A Proxmox VE server (version 6.x or later)
8+
- Root access to the Proxmox server
9+
- Sufficient storage space on the Proxmox server
10+
11+
## Usage
12+
13+
1. Copy the script `bash -c "$(curl -fsSL https://raw.githubusercontent.com/six2dez/reconftw/master/Proxmox/reconftw_prox_deploy.sh)"` to your Proxmox server.
14+
15+
4. Follow the prompts to configure your LXC container. You'll be asked for:
16+
- Container ID
17+
- Storage location
18+
- Root filesystem size
19+
- RAM allocation
20+
- Number of CPU cores
21+
- Hostname
22+
- Password
23+
24+
5. The script will then:
25+
- Download the Debian template if not already present
26+
- Create and configure the LXC container
27+
- Install ReconFTW and its dependencies
28+
29+
6. Once completed, the script will display the container information, including ID, hostname, and password.
30+
31+
## Logging
32+
33+
The script generates a log file in `/var/log/` with the format `reconftw_deploy_YYYYMMDD_HHMMSS.log`. Refer to this log for detailed information about the deployment process.
34+
35+
## Post-Installation
36+
37+
After the script completes:
38+
39+
1. You can access the container using:
40+
41+
```bash
42+
pct enter <CONTAINER_ID>
43+
```
44+
45+
2. ReconFTW will be installed in `/opt/reconftw/`. Navigate to this directory to use ReconFTW.
46+
47+
3. Refer to the [ReconFTW documentation](https://github.com/six2dez/reconftw) for usage instructions.
48+
49+
## Troubleshooting
50+
51+
- If the script fails, check the log file for error messages.
52+
- Ensure you have sufficient storage space and resources on your Proxmox server.
53+
- Verify that your Proxmox server has internet access to download necessary packages.
54+
55+
## Security Note
56+
57+
Remember to change the default password after accessing the container for the first time.
58+
59+
## Support
60+
61+
For issues related to this deployment script, please open an issue in the GitHub repository. For ReconFTW-specific questions, refer to the [ReconFTW GitHub page](https://github.com/six2dez/reconftw).

Proxmox/reconftw_prox_deploy.sh

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
#!/bin/bash
2+
# Enhanced script to deploy ReconFTW in a LXC container on Proxmox using Debian 12
3+
4+
# Colors for better visualization
5+
RED='\033[0;31m'
6+
GREEN='\033[0;32m'
7+
YELLOW='\033[1;33m'
8+
NC='\033[0m'
9+
10+
# Logging configuration
11+
LOGFILE="/var/log/reconftw_deploy_$(date +%Y%m%d_%H%M%S).log"
12+
exec 1> >(tee -a "$LOGFILE") 2>&1
13+
14+
# Logging function
15+
log() {
16+
echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
17+
}
18+
19+
# Function to show errors and exit
20+
error_exit() {
21+
log "${RED}ERROR: $1${NC}"
22+
exit 1
23+
}
24+
25+
# Function to validate numbers
26+
validate_number() {
27+
if ! [[ "$1" =~ ^[0-9]+$ ]]; then
28+
error_exit "Please enter a valid number"
29+
fi
30+
}
31+
32+
# Enhanced input function with validation
33+
get_input() {
34+
local prompt=$1
35+
local default=$2
36+
local validate_func=$3
37+
local result
38+
39+
while true; do
40+
read -p "$prompt [Default: $default]: " result
41+
result="${result:-$default}"
42+
43+
if [[ -n "$validate_func" ]]; then
44+
if $validate_func "$result"; then
45+
echo "$result"
46+
return 0
47+
fi
48+
else
49+
echo "$result"
50+
return 0
51+
fi
52+
done
53+
}
54+
55+
# Function to validate disk space
56+
check_storage_space() {
57+
local storage=$1
58+
local required_space=$2
59+
60+
# Get available space in GB
61+
available_space=$(pvesm status | grep "$storage" | awk '{print $5}' | sed 's/G//')
62+
63+
if (( available_space < required_space )); then
64+
error_exit "Not enough space in $storage. Available: ${available_space}GB, Required: ${required_space}GB"
65+
fi
66+
}
67+
68+
# Verify root execution
69+
[[ $EUID -ne 0 ]] && error_exit "This script must be run as root"
70+
71+
# Verify Proxmox environment
72+
[[ ! -f /etc/pve/local/pve-ssl.key ]] && error_exit "This script must be run on a Proxmox server"
73+
74+
# Template configuration
75+
TEMPLATE_NAME="debian-11-standard_11.7-1_amd64.tar.zst"
76+
TEMPLATE_PATH="local:vztmpl/${TEMPLATE_NAME}"
77+
78+
# Verify and download template
79+
log "${YELLOW}Checking template...${NC}"
80+
if ! pveam list local| grep -q $TEMPLATE_NAME; then
81+
log "Downloading template ${TEMPLATE_NAME}..."
82+
pveam download local $TEMPLATE_NAME || error_exit "Error downloading template"
83+
fi
84+
85+
# Get next available ID
86+
NEXTID=$(pvesh get /cluster/nextid)
87+
CONTAINER_ID=$(get_input "Container ID" $NEXTID validate_number)
88+
89+
# Container configuration with validations
90+
STORAGE=$(get_input "Storage" "local-lvm")
91+
ROOTFS_SIZE=$(get_input "Root filesystem size (GB)" "20" validate_number)
92+
MEMORY=$(get_input "RAM Memory (MB)" "2048" validate_number)
93+
CPU_CORES=$(get_input "Number of CPUs" "2" validate_number)
94+
HOSTNAME=$(get_input "Hostname" "reconftw-container")
95+
PASSWORD=$(get_input "Password" "$(openssl rand -base64 12)")
96+
97+
# Verify storage space
98+
check_storage_space "$STORAGE" "$ROOTFS_SIZE"
99+
100+
# Configuration summary
101+
log "${GREEN}Container configuration:${NC}"
102+
echo "ID: $CONTAINER_ID"
103+
echo "Storage: $STORAGE"
104+
echo "Size: ${ROOTFS_SIZE}GB"
105+
echo "RAM: ${MEMORY}MB"
106+
echo "CPUs: $CPU_CORES"
107+
echo "Hostname: $HOSTNAME"
108+
109+
# Create container with error handling
110+
log "${YELLOW}Creating LXC container...${NC}"
111+
pct create $CONTAINER_ID $TEMPLATE_PATH \
112+
--storage $STORAGE \
113+
--rootfs $STORAGE:${ROOTFS_SIZE} \
114+
--memory $MEMORY \
115+
--cores $CPU_CORES \
116+
--hostname $HOSTNAME \
117+
--password "$PASSWORD" \
118+
--unprivileged 1 \
119+
--net0 name=eth0,bridge=vmbr0,ip=dhcp || error_exit "Error creating container"
120+
121+
# Start container
122+
log "${YELLOW}Starting container...${NC}"
123+
pct start $CONTAINER_ID || error_exit "Error starting container"
124+
125+
# Wait for container to be ready
126+
log "Waiting for container to be ready..."
127+
for i in {1..15}; do
128+
if pct exec $CONTAINER_ID -- systemctl is-system-running &>/dev/null; then
129+
break
130+
fi
131+
sleep 2
132+
done
133+
134+
# Install ReconFTW
135+
log "${YELLOW}Installing ReconFTW and dependencies...${NC}"
136+
pct exec $CONTAINER_ID -- bash -c "apt update && \
137+
DEBIAN_FRONTEND=noninteractive apt -y upgrade && \
138+
apt install -y git sudo python3 python3-pip && \
139+
cd /opt && \
140+
git clone --recursive https://github.com/six2dez/reconftw.git && \
141+
cd reconftw && \
142+
./install.sh" || error_exit "Error installing ReconFTW"
143+
144+
# Show final information
145+
log "${GREEN}Installation completed${NC}"
146+
echo "Container information:"
147+
echo "ID: $CONTAINER_ID"
148+
echo "Hostname: $HOSTNAME"
149+
echo "Password: $PASSWORD"
150+
echo "Log file: $LOGFILE"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ reset='\033[0m'
501501

502502
## Hosts
503503

504-
- IP info ([whoisxmlapi API](https://www.whoisxmlapi.com/))
504+
- IP info ([ipinfo](https://www.ipinfo.io/))
505505
- CDN checker ([ipcdn](https://github.com/six2dez/ipcdn))
506506
- WAF checker ([wafw00f](https://github.com/EnableSecurity/wafw00f))
507507
- Port Scanner (Active with [nmap](https://github.com/nmap/nmap) and passive with [smap](https://github.com/s0md3v/Smap))

0 commit comments

Comments
 (0)