@@ -71,7 +71,7 @@ chmod +x ./configure
7171HOMEBREW_PREFIX=" /opt/homebrew"
7272GCC_BIN=" $HOMEBREW_PREFIX /bin/$( ls $HOMEBREW_PREFIX /bin | grep -E ' ^gcc-[0-9]+$' | sort -V | tail -n1) "
7373
74- ./configure CC=" $GCC_BIN " LDFLAGS=" -L$HOMEBREW_PREFIX /lib" CPPFLAGS=" -I$HOMEBREW_PREFIX /include"
74+ ./configure CC=" $GCC_BIN " LDFLAGS=" -L$HOMEBREW_PREFIX /lib" CPPFLAGS=" -I$HOMEBREW_PREFIX /include" --disable-native-tests
7575
7676echo " Cleaning previous builds..."
7777make -s clean
@@ -80,3 +80,55 @@ echo "Building John the Ripper..."
8080make -sj" $( sysctl -n hw.ncpu) "
8181
8282echo " John the Ripper build complete. Binaries are in $JOHN_RUN_DIR "
83+
84+ # Strip unnecessary files to reduce package size
85+ echo " Stripping unnecessary files..."
86+ cd " $JOHN_RUN_DIR "
87+
88+ # Count before
89+ BEFORE_COUNT=$( find . -type f | wc -l | tr -d ' ' )
90+ if [ " $BEFORE_COUNT " -eq 0 ]; then
91+ echo " Error: No files found in $JOHN_RUN_DIR - build may have failed"
92+ exit 1
93+ fi
94+ BEFORE_SIZE=$( du -sm . | cut -f1)
95+
96+ # Remove files in root directory only (preserve subdirectories like rules/)
97+ find . -maxdepth 1 -type f | while read -r file; do
98+ basename=" $( basename " $file " ) "
99+ keep=false
100+
101+ # Keep specific executables
102+ if [[ " $basename " == " john" || " $basename " == " zip2john" ]]; then
103+ keep=true
104+ # Keep pdf2john.py
105+ elif [[ " $basename " == " pdf2john.py" ]]; then
106+ keep=true
107+ # Keep all .conf files
108+ elif [[ " $basename " == * .conf ]]; then
109+ keep=true
110+ # Keep all .chr files
111+ elif [[ " $basename " == * .chr ]]; then
112+ keep=true
113+ # Keep shared libraries
114+ elif [[ " $basename " == libcrypto* || " $basename " == libssl* || " $basename " == libz* || " $basename " == libgmp* ]]; then
115+ keep=true
116+ fi
117+
118+ if [ " $keep " = false ]; then
119+ rm -f " $file "
120+ fi
121+ done
122+
123+ # Count after
124+ AFTER_COUNT=$( find . -type f | wc -l | tr -d ' ' )
125+ if [ " $AFTER_COUNT " -eq 0 ]; then
126+ echo " Error: All files were removed from $JOHN_RUN_DIR - file removal logic may be incorrect"
127+ exit 1
128+ fi
129+ AFTER_SIZE=$( du -sm . | cut -f1)
130+ SAVED=$(( BEFORE_COUNT - AFTER_COUNT))
131+ SIZE_SAVED=$(( BEFORE_SIZE - AFTER_SIZE))
132+
133+ echo " Removed $SAVED files (saved ${SIZE_SAVED} MB)"
134+ echo " Kept $AFTER_COUNT essential files (${AFTER_SIZE} MB) in $JOHN_RUN_DIR "
0 commit comments