Skip to content

Commit 4cdd11b

Browse files
committed
Initial commit
0 parents  commit 4cdd11b

File tree

9 files changed

+399
-0
lines changed

9 files changed

+399
-0
lines changed

.github/workflows/go.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Go
2+
on:
3+
push:
4+
branches: [ master ]
5+
pull_request:
6+
branches: [ master ]
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
go-version: [1.19.x]
14+
os: [ubuntu-latest, windows-latest]
15+
steps:
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: ${{ matrix.go-version }}
20+
- name: Check out code into the Go module directory
21+
uses: actions/checkout@v2
22+
- name: Get dependencies
23+
run: go mod download
24+
- name: Build
25+
run: go build -v ./...
26+
- name: Test
27+
run: go test -v ./...

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [created]
5+
permissions:
6+
contents: write
7+
packages: write
8+
jobs:
9+
releases-matrix:
10+
name: Release ja3proxy binary
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
# build and publish in parallel: linux/amd64, linux/arm64,
15+
# windows/amd64, windows/arm64, darwin/amd64, darwin/arm64
16+
goos: [ linux, windows, darwin ]
17+
goarch: [ amd64, arm64 ]
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: wangyoucao577/go-release-action@v1.29
21+
with:
22+
github_token: ${{ secrets.GITHUB_TOKEN }}
23+
goos: ${{ matrix.goos }}
24+
goarch: ${{ matrix.goarch }}
25+
binary_name: "ja3proxy"

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Output of the go coverage tool, specifically when used with LiteIDE
15+
*.out
16+
17+
# Dependency directories (remove the comment below to include it)
18+
# vendor/
19+
20+
# Go workspace file
21+
go.work
22+
23+
*.pem

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# JA3Proxy
2+
3+
Customizing TLS (JA3) Fingerprints through HTTP Proxy
4+
5+
## Usage
6+
7+
```bash
8+
git clone https://github.com/lylemi/ja3proxy
9+
cd ja3proxy
10+
make
11+
./ja3proxy -port 8080 -client 360Browser -version 7.5
12+
curl -v -k --proxy http://localhost:8080 https://www.example.com
13+
```
14+
15+
### Perdefined clients and versions
16+
17+
> for full list, see: https://github.com/refraction-networking/utls/blob/master/u_common.go
18+
19+
| Client | Version |
20+
| ------ | ------- |
21+
| Golang | 0 |
22+
| Firefox | 55 |
23+
| Firefox | 56 |
24+
| Firefox | 63 |
25+
| Firefox | 99 |
26+
| Firefox | 105 |
27+
| Chrome | 58 |
28+
| Chrome | 62 |
29+
| Chrome | 70 |
30+
| Chrome | 96 |
31+
| Chrome | 102 |
32+
| Chrome | 106 |
33+
| iOS | 12.1 |
34+
| iOS | 13 |
35+
| iOS | 14 |
36+
| Android | 11 |
37+
| Edge | 85 |
38+
| Edge | 106 |
39+
| Safari | 16.0 |
40+
| 360Browser | 7.5 |
41+
| QQBrowser | 11.1 |
42+
43+
## Contribution
44+
45+
If you have any ideas or suggestions, please feel free to submit a pull request. We appreciate any contributions.
46+
47+
## Contact
48+
49+
If you have any questions or suggestions, please feel free to contact us.

cert.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package main
2+
3+
import (
4+
"crypto/rand"
5+
"crypto/rsa"
6+
"crypto/x509"
7+
"crypto/x509/pkix"
8+
"encoding/pem"
9+
"math/big"
10+
"os"
11+
"time"
12+
)
13+
14+
func generateCertificate() error {
15+
priv, err := rsa.GenerateKey(rand.Reader, 2048)
16+
if err != nil {
17+
return err
18+
}
19+
20+
notBefore := time.Now()
21+
notAfter := notBefore.Add(365 * 24 * time.Hour)
22+
template := x509.Certificate{
23+
SerialNumber: big.NewInt(1),
24+
Subject: pkix.Name{CommonName: "localhost"},
25+
NotBefore: notBefore,
26+
NotAfter: notAfter,
27+
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
28+
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
29+
BasicConstraintsValid: true,
30+
IsCA: true,
31+
}
32+
33+
derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv)
34+
if err != nil {
35+
return err
36+
}
37+
38+
certOut, err := os.Create("cert.pem")
39+
if err != nil {
40+
return err
41+
}
42+
defer certOut.Close()
43+
pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes})
44+
45+
keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
46+
if err != nil {
47+
return err
48+
}
49+
defer keyOut.Close()
50+
pem.Encode(keyOut, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)})
51+
return nil
52+
}

go.mod

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module github.com/lylemi/ja3proxy
2+
3+
go 1.20
4+
5+
require github.com/refraction-networking/utls v1.3.2
6+
7+
require (
8+
github.com/andybalholm/brotli v1.0.4 // indirect
9+
github.com/gaukas/godicttls v0.0.3 // indirect
10+
github.com/klauspost/compress v1.15.15 // indirect
11+
golang.org/x/crypto v0.5.0 // indirect
12+
golang.org/x/sys v0.5.0 // indirect
13+
)

go.sum

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=
2+
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
3+
github.com/gaukas/godicttls v0.0.3 h1:YNDIf0d9adcxOijiLrEzpfZGAkNwLRzPaG6OjU7EITk=
4+
github.com/gaukas/godicttls v0.0.3/go.mod h1:l6EenT4TLWgTdwslVb4sEMOCf7Bv0JAK67deKr9/NCI=
5+
github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw=
6+
github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4=
7+
github.com/refraction-networking/utls v1.3.2 h1:o+AkWB57mkcoW36ET7uJ002CpBWHu0KPxi6vzxvPnv8=
8+
github.com/refraction-networking/utls v1.3.2/go.mod h1:fmoaOww2bxzzEpIKOebIsnBvjQpqP7L2vcm/9KUfm/E=
9+
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
10+
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
11+
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
12+
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.PHONY: all build-linux build-windows clean
2+
3+
BINARY_NAME=ja3proxy
4+
BINARY_LINUX=$(BINARY_NAME)
5+
BINARY_WINDOWS=$(BINARY_NAME).exe
6+
7+
all: build-linux build-windows
8+
9+
build-linux:
10+
GOOS=linux GOARCH=amd64 go build -o $(BINARY_LINUX)
11+
12+
build-windows:
13+
GOOS=windows GOARCH=amd64 go build -o $(BINARY_WINDOWS)
14+
15+
clean:
16+
rm -f $(BINARY_LINUX) $(BINARY_WINDOWS)

0 commit comments

Comments
 (0)