|
| 1 | +# π Development Setup Guide |
| 2 | + |
| 3 | +## Hot-Reload Development Environment |
| 4 | + |
| 5 | +### Prerequisites |
| 6 | +- Node.js 18+ installed |
| 7 | +- npm or yarn package manager |
| 8 | + |
| 9 | +### Quick Start |
| 10 | + |
| 11 | +```bash |
| 12 | +# Navigate to the Kali Dashboard |
| 13 | +cd kali-dashboard |
| 14 | + |
| 15 | +# Install dependencies |
| 16 | +npm install |
| 17 | + |
| 18 | +# Start development server with hot-reload |
| 19 | +npm run dev |
| 20 | + |
| 21 | +# Open in browser |
| 22 | +open http://localhost:5173 |
| 23 | +``` |
| 24 | + |
| 25 | +### π₯ Hot-Reload Features |
| 26 | + |
| 27 | +The development server includes: |
| 28 | +- **Instant Updates**: Changes reflect immediately in browser |
| 29 | +- **Component Hot Reload**: React components update without losing state |
| 30 | +- **CSS Hot Reload**: Style changes apply instantly |
| 31 | +- **Error Overlay**: Development errors shown in browser |
| 32 | +- **Fast Refresh**: Preserves component state during edits |
| 33 | + |
| 34 | +### π οΈ Development Commands |
| 35 | + |
| 36 | +```bash |
| 37 | +# Development server (hot-reload enabled) |
| 38 | +npm run dev |
| 39 | + |
| 40 | +# Build for production |
| 41 | +npm run build |
| 42 | + |
| 43 | +# Preview production build |
| 44 | +npm run preview |
| 45 | + |
| 46 | +# Run linting |
| 47 | +npm run lint |
| 48 | + |
| 49 | +# Type checking (if using TypeScript) |
| 50 | +npm run type-check |
| 51 | +``` |
| 52 | + |
| 53 | +### π Project Structure |
| 54 | + |
| 55 | +``` |
| 56 | +kali-dashboard/ |
| 57 | +βββ src/ |
| 58 | +β βββ components/ # Reusable components |
| 59 | +β β βββ ProxyControl.jsx # π« Proxy blocking interface |
| 60 | +β β βββ QuickScanTools.jsx # β‘ Network scanning tools |
| 61 | +β β βββ SecurityMonitoring.jsx # π‘οΈ Real-time threat detection |
| 62 | +β βββ pages/ |
| 63 | +β β βββ SecurityCenter.jsx # π Main security dashboard |
| 64 | +β β βββ Dashboard.jsx # π Overview dashboard |
| 65 | +β β βββ NmapScanner.jsx # π Network scanner |
| 66 | +β β βββ MetasploitConsole.jsx # π₯ Exploit framework |
| 67 | +β β βββ Terminal.jsx # π» Terminal emulator |
| 68 | +β βββ contexts/ # React Context providers |
| 69 | +β βββ App.jsx # Main application |
| 70 | +βββ public/ # Static assets |
| 71 | +βββ package.json # Dependencies and scripts |
| 72 | +``` |
| 73 | + |
| 74 | +### π― New Security Features Added |
| 75 | + |
| 76 | +#### 1. **Proxy Control Center** (`/security` β Proxy Control tab) |
| 77 | +- **Block/Unblock Proxy**: Control network proxy access |
| 78 | +- **Emergency Lockdown**: Instant network isolation |
| 79 | +- **Real-time Status**: Live proxy monitoring |
| 80 | +- **Activity Logs**: Track all proxy actions |
| 81 | + |
| 82 | +#### 2. **Quick Scan Tools** (`/security` β Quick Scan Tools tab) |
| 83 | +- **Port Scanning**: TCP port discovery |
| 84 | +- **Vulnerability Detection**: CVE scanning |
| 85 | +- **Network Discovery**: Host enumeration |
| 86 | +- **Service Detection**: Running service identification |
| 87 | +- **Progress Tracking**: Real-time scan progress |
| 88 | +- **Results Export**: Detailed scan reports |
| 89 | + |
| 90 | +#### 3. **Security Monitoring** (`/security` β Security Monitoring tab) |
| 91 | +- **Real-time Threat Detection**: Live security alerts |
| 92 | +- **Threat Classification**: Critical/High/Medium/Low severity |
| 93 | +- **Automated Response**: Block/ignore threats |
| 94 | +- **Alert Dashboard**: Centralized security notifications |
| 95 | +- **System Status**: Overall security posture |
| 96 | + |
| 97 | +### π§ Adding New Features |
| 98 | + |
| 99 | +#### Adding a New Security Tool |
| 100 | + |
| 101 | +1. **Create Component**: |
| 102 | +```bash |
| 103 | +# Create new component file |
| 104 | +touch src/components/MySecurityTool.jsx |
| 105 | +``` |
| 106 | + |
| 107 | +2. **Component Template**: |
| 108 | +```jsx |
| 109 | +import { useState, useEffect } from 'react'; |
| 110 | + |
| 111 | +const MySecurityTool = () => { |
| 112 | + const [status, setStatus] = useState('idle'); |
| 113 | + |
| 114 | + const handleAction = async () => { |
| 115 | + setStatus('running'); |
| 116 | + // Your security tool logic here |
| 117 | + setTimeout(() => setStatus('completed'), 2000); |
| 118 | + }; |
| 119 | + |
| 120 | + return ( |
| 121 | + <div className="bg-gray-900 rounded-lg p-6 border border-gray-700"> |
| 122 | + <h2 className="text-xl font-bold text-kali-green mb-4"> |
| 123 | + π§ My Security Tool |
| 124 | + </h2> |
| 125 | + |
| 126 | + <button |
| 127 | + onClick={handleAction} |
| 128 | + disabled={status === 'running'} |
| 129 | + className="bg-blue-600 hover:bg-blue-700 disabled:bg-gray-600 text-white px-4 py-2 rounded-lg" |
| 130 | + > |
| 131 | + {status === 'running' ? 'Running...' : 'Start Tool'} |
| 132 | + </button> |
| 133 | + </div> |
| 134 | + ); |
| 135 | +}; |
| 136 | + |
| 137 | +export default MySecurityTool; |
| 138 | +``` |
| 139 | + |
| 140 | +3. **Add to Security Center**: |
| 141 | +```jsx |
| 142 | +// In src/pages/SecurityCenter.jsx |
| 143 | +import MySecurityTool from '../components/MySecurityTool'; |
| 144 | + |
| 145 | +// Add to tabs array |
| 146 | +{ |
| 147 | + id: 'mytool', |
| 148 | + name: 'My Tool', |
| 149 | + icon: 'π§', |
| 150 | + component: MySecurityTool |
| 151 | +} |
| 152 | +``` |
| 153 | + |
| 154 | +### π¨ Styling Guidelines |
| 155 | + |
| 156 | +- **Colors**: Use Kali Linux theme colors |
| 157 | + - `text-kali-green`: Primary green (#00ff41) |
| 158 | + - `bg-gray-900`: Dark backgrounds |
| 159 | + - `border-gray-700`: Subtle borders |
| 160 | + - `text-red-400`: Error/critical states |
| 161 | + - `text-yellow-400`: Warning states |
| 162 | + |
| 163 | +- **Components**: Follow existing patterns |
| 164 | + - Rounded corners: `rounded-lg` |
| 165 | + - Padding: `p-4` or `p-6` |
| 166 | + - Spacing: `space-y-4` or `space-x-4` |
| 167 | + - Transitions: `transition-all duration-200` |
| 168 | + |
| 169 | +### π Hot-Reload Workflow |
| 170 | + |
| 171 | +1. **Start Development Server**: |
| 172 | +```bash |
| 173 | +npm run dev |
| 174 | +``` |
| 175 | + |
| 176 | +2. **Make Changes**: Edit any file in `src/` |
| 177 | + |
| 178 | +3. **See Instant Updates**: Browser automatically refreshes |
| 179 | + |
| 180 | +4. **Debug**: Use browser dev tools + React DevTools |
| 181 | + |
| 182 | +### π Production Build |
| 183 | + |
| 184 | +```bash |
| 185 | +# Build optimized production bundle |
| 186 | +npm run build |
| 187 | + |
| 188 | +# Serve production build locally |
| 189 | +npm run preview |
| 190 | + |
| 191 | +# Deploy dist/ folder to your server |
| 192 | +``` |
| 193 | + |
| 194 | +### π Troubleshooting |
| 195 | + |
| 196 | +#### Hot-Reload Not Working |
| 197 | +```bash |
| 198 | +# Clear node_modules and reinstall |
| 199 | +rm -rf node_modules package-lock.json |
| 200 | +npm install |
| 201 | +npm run dev |
| 202 | +``` |
| 203 | + |
| 204 | +#### Port Already in Use |
| 205 | +```bash |
| 206 | +# Use different port |
| 207 | +npm run dev -- --port 3001 |
| 208 | +``` |
| 209 | + |
| 210 | +#### Build Errors |
| 211 | +```bash |
| 212 | +# Check for linting issues |
| 213 | +npm run lint |
| 214 | + |
| 215 | +# Clear Vite cache |
| 216 | +rm -rf node_modules/.vite |
| 217 | +npm run dev |
| 218 | +``` |
| 219 | + |
| 220 | +### π¦ Adding Dependencies |
| 221 | + |
| 222 | +```bash |
| 223 | +# Add new package |
| 224 | +npm install package-name |
| 225 | + |
| 226 | +# Add dev dependency |
| 227 | +npm install -D package-name |
| 228 | + |
| 229 | +# Update package.json and restart dev server |
| 230 | +npm run dev |
| 231 | +``` |
| 232 | + |
| 233 | +### π Security Best Practices |
| 234 | + |
| 235 | +- **Input Validation**: Always validate user inputs |
| 236 | +- **XSS Prevention**: Use React's built-in XSS protection |
| 237 | +- **API Security**: Implement proper authentication |
| 238 | +- **Error Handling**: Don't expose sensitive information |
| 239 | +- **HTTPS**: Use HTTPS in production |
| 240 | + |
| 241 | +--- |
| 242 | + |
| 243 | +**Happy Coding! π** Your secure dashboard is ready for development with instant hot-reload capabilities! |
0 commit comments