Skip to content

Commit c36ff75

Browse files
committed
Add server example
1 parent a7169b1 commit c36ff75

269 files changed

Lines changed: 12617 additions & 1362 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* text=auto eol=lf
2+
3+
*.blade.php diff=html
4+
*.css diff=css
5+
*.html diff=html
6+
*.md diff=markdown
7+
*.php diff=php
8+
9+
/.github export-ignore
10+
CHANGELOG.md export-ignore
11+
.styleci.yml export-ignore

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/.phpunit.cache
2+
/node_modules
3+
/public/build
4+
/public/hot
5+
/public/storage
6+
/storage/*.key
7+
/vendor
8+
.env
9+
.env.backup
10+
.env.production
11+
.phpunit.result.cache
12+
Homestead.json
13+
Homestead.yaml
14+
auth.json
15+
npm-debug.log
16+
yarn-error.log
17+
/.fleet
18+
/.idea
19+
/.vscode

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
# Weakpass (JS)
1+
# Weakpass
22

33
<p align="center">
44
<img src="https://github.com/zzzteph/weakpass/blob/readme/cracker.png?raw=true" height="250">
55
</p>
66

7-
Here, you can find the list of tools from [weakpass.com](https://weakpass.com/) for password and hash cracking in one place.
7+
Here, you can find the list of tools and example of API server from [weakpass.com](https://weakpass.com/) for password and hash cracking in one place.
88

99
### 📂 Folder Structure
1010

11+
- **server**
12+
- Server demo-example for the Weakpass API.
13+
1114
- **tools**
1215
- A collection of password and hash cracking tools. **Check them out:**
1316
- [Kraker-js](https://zzzteph.github.io/weakpass/tools/kraker-js/dist/)
@@ -54,7 +57,7 @@ Perform secure hash lookups without submitting sensitive data to a server using
5457
<img src="https://github.com/zzzteph/weakpass/blob/main/tools/lookup/lookup.PNG?raw=true" height="250">
5558
</p>
5659

57-
Reveal passwords for MD5, NTLM, SHA1, or SHA256 hashes using the precomputed `weakpass4.merged.txt` file without sending your hash to the backend. The primary advantage is that all hash checks are done client-side, ensuring that your data remains secure and private.
60+
Reveal passwords for MD5, NTLM, SHA1, or SHA256 hashes using the precomputed wordlist without sending your hash to the backend. The primary advantage is that all hash checks are done client-side, ensuring that your data remains secure and private.
5861

5962
Additionally, you can host and build the database for this tool locally and in-house. To do so, use one of the precomputed tables available [here](https://weakpass.com/pre-computed) and set up an API to serve hash ranges by value.
6063

@@ -74,7 +77,7 @@ Online: [Passcheck](https://zzzteph.github.io/weakpass/tools/passcheck/dist/)
7477
</p>
7578

7679

77-
This tool checks if your password exists in the **weakpass_4.merged** wordlist using a range lookup API.
80+
This tool checks if your password exists in the precomputed wordlist using a range lookup API.
7881

7982
**But what if someone decided to use a rule-based attack? Is your password safe for rule-based attacks?**
8083
Beyond that, it simulates rule-based attacks by applying "reverse" hashcat rules to identify potential candidates that could be used with the rules to crack your password.

server/.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[docker-compose.yml]
18+
indent_size = 4

server/.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* text=auto eol=lf
2+
3+
*.blade.php diff=html
4+
*.css diff=css
5+
*.html diff=html
6+
*.md diff=markdown
7+
*.php diff=php
8+
9+
/.github export-ignore
10+
CHANGELOG.md export-ignore
11+
.styleci.yml export-ignore

server/.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
*.log
2+
.DS_Store
3+
.env
4+
.env.backup
5+
.env.production
6+
.phpactor.json
7+
.phpunit.result.cache
8+
/.fleet
9+
/.idea
10+
/.nova
11+
/.phpunit.cache
12+
/.vscode
13+
/.zed
14+
/auth.json
15+
/node_modules
16+
/public/build
17+
/public/hot
18+
/public/storage
19+
/storage/*.key
20+
/storage/pail
21+
/vendor
22+
Homestead.json
23+
Homestead.yaml
24+
Thumbs.db
25+
26+
**/caddy
27+
frankenphp
28+
frankenphp-worker.php

server/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM dunglas/frankenphp
2+
3+
WORKDIR /weakpass
4+
5+
COPY . .
6+
7+
RUN apt-get update && apt-get install -y git zip 7zip && rm -rf /var/lib/apt/lists/*
8+
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
9+
RUN install-php-extensions \
10+
pcntl
11+
12+
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
13+
RUN composer require laravel/octane --no-interaction
14+
15+
RUN php artisan key:generate \
16+
&& php artisan storage:link \
17+
&& php artisan octane:install --server=frankenphp
18+
19+
ENTRYPOINT ["php", "artisan", "octane:frankenphp"]

server/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Weakpass – Sample API Server
2+
3+
<p align="center">
4+
<img src="https://github.com/zzzteph/weakpass/blob/readme/cracker.png?raw=true" height="250">
5+
</p>
6+
7+
This is an example server and build scripts for the Weakpass API.
8+
9+
## Build & Run
10+
11+
```bash
12+
docker build . -t weakpass_api
13+
docker run -p 8000:8000 weakpass_api
14+
```
15+
16+
Navigate to:
17+
18+
- API root: [http://127.0.0.1/](http://127.0.0.1/)
19+
- Swagger docs: [http://127.0.0.1/api/](http://127.0.0.1/api/)
20+
- Example API test: [http://127.0.0.1/api/v1/range/0000009?type=md5](http://127.0.0.1/api/v1/range/0000009?type=md5)
21+
22+
## Scripts
23+
24+
In the `/app/Console` folder, you can find scripts to build your own database or filter wordlists.
25+
26+
### Filter Wordlist
27+
28+
```bash
29+
php artisan app:filter-wordlist {input-file} {output-file} {--sort}
30+
```
31+
32+
Removes junk data from a wordlist.
33+
34+
**Arguments:**
35+
- `input-file` – path to the wordlist you want to filter
36+
- `output-file` – path where the filtered list will be saved
37+
- `--sort` – optional flag to sort the results alphabetically
38+
39+
### Examples
40+
41+
```bash
42+
cd /weakpass/
43+
php artisan app:filter-wordlist /download/rockyou.txt /download/rockyou.txt.filtered
44+
```
45+
Creates `/download/rockyou.txt.filtered` with junk data removed.
46+
47+
```bash
48+
cd /weakpass/
49+
php artisan app:filter-wordlist /download/rockyou.txt /download/rockyou.txt.filtered --sort
50+
```
51+
Creates `/download/rockyou.txt.filtered` with junk data removed **and** sorted alphabetically.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
use Illuminate\Support\Facades\Log;
5+
use Illuminate\Console\Command;
6+
use Illuminate\Support\Facades\Process;
7+
class BuildLookupTree extends Command
8+
{
9+
/**
10+
* The name and signature of the console command.
11+
*
12+
* @var string
13+
*/
14+
protected $signature = 'app:build-lookup-tree {folder} {file} {type}';
15+
16+
/**
17+
* The console command description.
18+
*
19+
* @var string
20+
*/
21+
protected $description = 'Build database for new weakpass';
22+
23+
24+
25+
public function handle()
26+
{
27+
28+
29+
30+
if(!file_exists($this->argument('folder')) || !is_dir($this->argument('folder')))
31+
{
32+
$this->error($this->argument('folder')." not exist");
33+
die();
34+
}
35+
36+
if(!file_exists($this->argument('file')))
37+
{
38+
$this->error($this->argument('file')." not exist");
39+
die();
40+
}
41+
42+
$type=$this->argument('type');
43+
$handle = fopen($this->argument('file'), "r");
44+
$folder=$this->argument('folder');
45+
$prefix="";
46+
$prefix_file=FALSE;
47+
$files=array();
48+
if ($handle) {
49+
while (($line = fgets($handle)) !== false) {
50+
$tmp_prefix=substr($line, 0, 6);
51+
if($tmp_prefix!==$prefix)
52+
{
53+
54+
if ($prefix_file) fclose($prefix_file);
55+
$folder1 = substr($tmp_prefix, 0, 2);
56+
$folder2 = substr($tmp_prefix, 2, 2);
57+
$file = substr($tmp_prefix, 4, 2);
58+
if(!file_exists($folder.$folder1))mkdir($folder.$folder1);
59+
if(!file_exists($folder.$folder1."/".$folder2))mkdir($folder.$folder1."/".$folder2);
60+
61+
$path=$folder.$folder1."/".$folder2."/".$file."_".$type;
62+
$this->info($path);
63+
$prefix_file = fopen($path, 'a+w');
64+
$prefix=$tmp_prefix;
65+
}
66+
fwrite($prefix_file,$line);
67+
}
68+
fclose($handle);
69+
}
70+
if ($prefix_file) fclose($prefix_file);
71+
72+
73+
74+
75+
}
76+
}

0 commit comments

Comments
 (0)