Files
hasher/QUICK_REFERENCE.md
2025-12-04 00:58:40 +01:00

146 líneas
3.2 KiB
Markdown

# Hasher - Quick Reference Card
## 🚀 Quick Commands
### Development
```bash
npm run dev # Start development server (http://localhost:3000)
npm run build # Build for production
npm start # Start production server
npm run lint # Run ESLint
```
### Bulk Indexing
```bash
npm run index-file <file> # Index wordlist file
npm run index-file <file> -- --batch-size N # Custom batch size
npm run index-file -- --help # Show help
```
## 🔍 Hash Detection Patterns
| Type | Length | Example |
|--------|--------|---------|
| MD5 | 32 | `5f4dcc3b5aa765d61d8327deb882cf99` |
| SHA1 | 40 | `5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8` |
| SHA256 | 64 | `5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8` |
| SHA512 | 128 | `b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb9...` |
| Bcrypt | 60 | `$2b$10$N9qo8uLOickgx2ZMRZoMye...` |
## 🔌 API Quick Reference
### Search/Generate
```bash
POST /api/search
Content-Type: application/json
{ "query": "password" }
```
### Health Check
```bash
GET /api/health
```
## 🌐 URLs
- **Web Interface**: http://localhost:3000
- **Search API**: http://localhost:3000/api/search
- **Health API**: http://localhost:3000/api/health
- **Elasticsearch**: http://localhost:9200
## 📊 Elasticsearch Commands
```bash
# Health
curl http://localhost:9200/_cluster/health?pretty
# Index stats
curl http://localhost:9200/hasher/_stats?pretty
# Document count
curl http://localhost:9200/hasher/_count?pretty
# Search
curl http://localhost:9200/hasher/_search?pretty
# Delete index (CAUTION!)
curl -X DELETE http://localhost:9200/hasher
```
## 🐛 Troubleshooting
| Problem | Solution |
|---------|----------|
| Can't connect to ES | Check `ELASTICSEARCH_NODE` env var |
| Port 3000 in use | Use `PORT=3001 npm run dev` |
| Module not found | Run `npm install` |
| Build errors | Run `npm run build` to see details |
## 📁 Important Files
| File | Purpose |
|------|---------|
| `app/page.tsx` | Main UI component |
| `app/api/search/route.ts` | Search endpoint |
| `lib/elasticsearch.ts` | ES configuration |
| `lib/hash.ts` | Hash utilities |
| `scripts/index-file.ts` | Bulk indexer |
## ⚙️ Environment Variables
```bash
# Required
ELASTICSEARCH_NODE=http://localhost:9200
# Optional
NODE_ENV=production
```
## 📝 Common Use Cases
### Search for a hash
1. Open http://localhost:3000
2. Enter hash value
3. Click Search
### Generate hashes
1. Open http://localhost:3000
2. Enter plaintext
3. Click Search
4. Copy desired hash
### Bulk index words
```bash
npm run index-file wordlist.txt
```
### Check system health
```bash
curl http://localhost:3000/api/health
```
## 🎯 Sample Hashes (password)
- **MD5**: `5f4dcc3b5aa765d61d8327deb882cf99`
- **SHA1**: `5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8`
- **SHA256**: `5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8`
## 📚 Documentation Links
- [README.md](README.md) - Main documentation
- [API.md](API.md) - API reference
- [DEPLOYMENT.md](DEPLOYMENT.md) - Deployment guide
- [TESTING.md](TESTING.md) - Testing guide
## 🆘 Get Help
```bash
npm run index-file -- --help # Indexer help
```
---
**Version**: 1.0.0
**Project**: Hasher
**License**: MIT