Skip to content

Commit 02bbb02

Browse files
committed
Initial commit
0 parents  commit 02bbb02

22 files changed

Lines changed: 2627 additions & 0 deletions

.gitattributes

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Linguist
2+
docs/** linguist-documentation=true
3+
scripts/** linguist-vendored=true
4+
samples/** linguist-documentation=true
5+
samples/*.lastlog binary
6+
samples/*.wtmp binary
7+
samples/*.utmp binary
8+
samples/*.btmp binary
9+
10+
# LF normalization
11+
*.rs text eol=lf diff=rust
12+
*.toml text eol=lf
13+
*.md text eol=lf
14+
*.yml text eol=lf
15+
*.yaml text eol=lf
16+
LICENSE text eol=lf
17+
.gitignore text eol=lf
18+
.gitattributes text eol=lf

.github/workflows/ci.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [stable, dev]
6+
paths:
7+
- 'src/**'
8+
- 'Cargo.toml'
9+
- 'scripts/**'
10+
pull_request:
11+
branches: [stable]
12+
13+
jobs:
14+
build:
15+
name: Build & Test
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: dtolnay/rust-toolchain@stable
20+
- run: cargo build --release
21+
- run: cargo test
22+
- name: Verify binary
23+
run: ./target/release/hidemylogs --version
24+
25+
generate-samples:
26+
name: Regenerate samples
27+
runs-on: ubuntu-latest
28+
needs: build
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-python@v5
32+
with:
33+
python-version: "3.12"
34+
- uses: dtolnay/rust-toolchain@stable
35+
36+
- name: Check if generate script changed
37+
id: check
38+
run: |
39+
if git diff --name-only HEAD~1 2>/dev/null | grep -q 'scripts/generate_samples.py'; then
40+
echo "changed=true" >> "$GITHUB_OUTPUT"
41+
else
42+
echo "changed=false" >> "$GITHUB_OUTPUT"
43+
fi
44+
45+
- name: Generate samples
46+
if: steps.check.outputs.changed == 'true'
47+
run: python3 scripts/generate_samples.py
48+
49+
- name: Build and verify samples parse
50+
if: steps.check.outputs.changed == 'true'
51+
run: |
52+
cargo build --release
53+
echo "--- utmp ---"
54+
./target/release/hidemylogs -q print -u samples/compromised.utmp -s u
55+
echo "--- wtmp ---"
56+
./target/release/hidemylogs -q print -w samples/compromised.wtmp -s w
57+
echo "--- btmp ---"
58+
./target/release/hidemylogs -q print -b samples/compromised.btmp -s b
59+
echo "--- lastlog ---"
60+
./target/release/hidemylogs -q print -l samples/compromised.lastlog -s l
61+
62+
- name: Commit updated samples
63+
if: steps.check.outputs.changed == 'true' && github.event_name == 'push'
64+
run: |
65+
git config user.name "franckferman"
66+
git config user.email "franckferman@users.noreply.github.com"
67+
git add samples/
68+
if git diff --cached --quiet; then
69+
echo "[*] No changes to samples."
70+
else
71+
git commit -m "Regenerate sample files"
72+
git push
73+
fi

.github/workflows/release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build ${{ matrix.name }}
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
include:
18+
- target: x86_64-unknown-linux-musl
19+
name: linux-x86_64-musl
20+
poly: false
21+
- target: x86_64-unknown-linux-musl
22+
name: linux-x86_64-musl-poly
23+
poly: true
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: actions/setup-python@v5
27+
if: matrix.poly
28+
with:
29+
python-version: "3.12"
30+
- uses: dtolnay/rust-toolchain@stable
31+
with:
32+
targets: ${{ matrix.target }}
33+
34+
- name: Install musl tools
35+
run: sudo apt-get update && sudo apt-get install -y musl-tools
36+
37+
- name: Polymorphic prep
38+
if: matrix.poly
39+
run: python3 scripts/polymorphic.py
40+
41+
- name: Build
42+
run: |
43+
if [ "${{ matrix.poly }}" = "true" ]; then
44+
RUSTFLAGS="-Ccontrol-flow-guard=no -Cforce-frame-pointers=no" \
45+
cargo build --profile poly --target ${{ matrix.target }}
46+
cp target/${{ matrix.target }}/poly/hidemylogs hidemylogs-${{ matrix.name }}
47+
else
48+
cargo build --release --target ${{ matrix.target }}
49+
cp target/${{ matrix.target }}/release/hidemylogs hidemylogs-${{ matrix.name }}
50+
fi
51+
52+
- name: Revert sources
53+
if: matrix.poly
54+
run: python3 scripts/polymorphic.py --revert
55+
56+
- name: Checksum
57+
run: sha256sum hidemylogs-${{ matrix.name }} > hidemylogs-${{ matrix.name }}.sha256
58+
59+
- name: Upload
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: hidemylogs-${{ matrix.name }}
63+
path: |
64+
hidemylogs-${{ matrix.name }}
65+
hidemylogs-${{ matrix.name }}.sha256
66+
67+
release:
68+
name: Create Release
69+
needs: build
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/download-artifact@v4
73+
with:
74+
merge-multiple: true
75+
76+
- name: Generate checksums
77+
run: cat *.sha256 > checksums.sha256
78+
79+
- name: Release
80+
uses: softprops/action-gh-release@v2
81+
with:
82+
name: ${{ github.ref_name }}
83+
files: |
84+
hidemylogs-*
85+
checksums.sha256
86+
generate_release_notes: true

.github/workflows/static.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Deploy static content to Pages
2+
3+
on:
4+
push:
5+
branches: ["stable"]
6+
paths:
7+
- "docs/**"
8+
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
19+
20+
jobs:
21+
deploy:
22+
environment:
23+
name: github-pages
24+
url: ${{ steps.deployment.outputs.page_url }}
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Setup Pages
31+
uses: actions/configure-pages@v5
32+
33+
- name: Upload artifact
34+
uses: actions/upload-pages-artifact@v3
35+
with:
36+
path: './docs'
37+
38+
- name: Deploy to GitHub Pages
39+
id: deployment
40+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Rust
2+
/target
3+
Cargo.lock
4+
5+
# Editors
6+
.vscode/
7+
.idea/
8+
*.swp
9+
*.swo
10+
*~
11+
12+
# OS
13+
.DS_Store
14+
Thumbs.db
15+
desktop.ini
16+
$RECYCLE.BIN/
17+
18+
# Signing
19+
*.pfx
20+
*.cer
21+
*.p12
22+
*.pem
23+
*.key
24+
.poly_backup/

Cargo.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[package]
2+
name = "hidemylogs"
3+
version = "1.0.0"
4+
edition = "2021"
5+
authors = ["Franck FERMAN <franckferman@users.noreply.github.com>"]
6+
description = "Surgical *nix log cleaner - selectively erase access records from lastlog, wtmp, btmp, and utmp while preserving file metadata"
7+
license = "AGPL-3.0"
8+
repository = "https://github.com/franckferman/hidemylogs"
9+
keywords = ["security", "forensics", "red-team", "post-exploitation", "logs"]
10+
categories = ["command-line-utilities"]
11+
12+
[dependencies]
13+
clap = { version = "4", features = ["derive"] }
14+
chrono = "0.4"
15+
colored = "2"
16+
filetime = "0.2"
17+
18+
[profile.release]
19+
opt-level = "z"
20+
lto = true
21+
strip = true
22+
panic = "abort"
23+
24+
# Polymorphic build profile: max obfuscation at compiler level
25+
[profile.poly]
26+
inherits = "release"
27+
opt-level = 3 # O3 instead of Oz: different inlining/vectorization decisions
28+
lto = "fat" # full cross-crate LTO: more aggressive reordering
29+
codegen-units = 1 # single codegen unit: deterministic but different layout from release
30+
strip = "symbols" # strip symbols but keep .rodata (our randomized strings)
31+
panic = "abort"
32+
overflow-checks = false # remove overflow checks: changes CFG
33+
debug-assertions = false

0 commit comments

Comments
 (0)