Skip to content

Commit 26d7e37

Browse files
committed
1.2.9 add WAF export and import
1 parent 3cdcd95 commit 26d7e37

File tree

11 files changed

+670
-325
lines changed

11 files changed

+670
-325
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Run `ng build` to build the project. The build artifacts will be stored in the `
2121
> ng build --prod
2222
2323
If `crypto` not found, try to change this file:
24-
> node_modules@angular-devkit\build-angular\src\angular-cli-files\models\webpack-configs\browser.js
24+
> node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\webpack-configs\browser.js
2525
and set node to new value:
2626

2727
> node: { crypto: true, stream: true, fs: 'empty', net: 'empty' }

package-lock.json

Lines changed: 462 additions & 217 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "janusec-admin",
3-
"version": "1.2.0",
3+
"version": "1.2.9",
44
"license": "MIT",
55
"scripts": {
66
"ng": "ng",
@@ -12,18 +12,19 @@
1212
},
1313
"private": true,
1414
"dependencies": {
15-
"@angular/animations": "^9.0.4",
15+
"@angular-devkit/core": "^9.1.13",
16+
"@angular/animations": "^9.1.13",
1617
"@angular/cdk": "^9.1.0",
17-
"@angular/common": "^9.0.4",
18-
"@angular/core": "^9.0.4",
18+
"@angular/common": "^9.1.13",
19+
"@angular/core": "^9.1.13",
1920
"@angular/flex-layout": "^9.0.0-beta.29",
20-
"@angular/forms": "^9.0.4",
21-
"@angular/localize": "^9.0.4",
21+
"@angular/forms": "^9.1.13",
22+
"@angular/localize": "^9.1.13",
2223
"@angular/material": "^9.1.0",
23-
"@angular/platform-browser": "^9.0.4",
24-
"@angular/platform-browser-dynamic": "^9.0.4",
25-
"@angular/router": "^9.0.4",
26-
"@types/node": "^12.12.27",
24+
"@angular/platform-browser": "^9.1.13",
25+
"@angular/platform-browser-dynamic": "^9.1.13",
26+
"@angular/router": "^9.1.13",
27+
"@ngtools/webpack": "^9.1.13",
2728
"angularx-qrcode": "^2.3.5",
2829
"bcryptjs": "^2.4.3",
2930
"chart.js": "^2.9.4",
@@ -42,15 +43,15 @@
4243
"webpack": "^4.41.6",
4344
"xterm": "^4.4.0",
4445
"xterm-addon-attach": "^0.5.0",
45-
"zone.js": "~0.10.2"
46+
"zone.js": "^0.10.3"
4647
},
4748
"devDependencies": {
4849
"@angular-builders/custom-webpack": "^8.4.1",
4950
"@angular-devkit/build-angular": "~0.900.4",
5051
"@angular/cli": "^9.1.15",
51-
"@angular/compiler": "^9.0.4",
52-
"@angular/compiler-cli": "^9.0.4",
53-
"@angular/language-service": "^9.0.4",
52+
"@angular/compiler": "^9.1.13",
53+
"@angular/compiler-cli": "^9.1.13",
54+
"@angular/language-service": "^9.1.13",
5455
"@types/bcryptjs": "^2.4.2",
5556
"@types/chart.js": "^2.9.27",
5657
"@types/crypto-js": "^3.1.43",
@@ -71,4 +72,4 @@
7172
"tslint": "~5.7.0",
7273
"typescript": "^3.7.7"
7374
}
74-
}
75+
}

proxy.config.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
"target": "ws://192.168.100.110:9080",
44
"secure": false,
55
"ws": true,
6-
"changeOrigin": true
6+
"changeOrigin": true,
7+
"logLevel": "debug"
78
},
8-
"/janusec-admin/": {
9+
"/janusec-admin/*": {
910
"target": "http://192.168.100.110:9080",
10-
"secure": false
11+
"secure": false,
12+
"changeOrigin": true,
13+
"logLevel": "debug"
1114
},
1215
"/favicon.ico": {
1316
"target": "http://192.168.100.110:9080/janusec-admin/",
14-
"secure": false
17+
"secure": false,
18+
"changeOrigin": true,
19+
"logLevel": "debug"
1520
}
1621
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.container {
2-
font-family: 'Courier New', Courier, monospace;
1+
.container {
2+
font-family: 'Courier New', Courier, monospace;
33
}

src/app/footer/footer.component.css

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
.mat-toolbar {
2-
font-size: 14px;
3-
height: 36px;
4-
font-family: 'Arial Narrow', Arial, sans-serif;
5-
text-align: center;
6-
}
7-
8-
.footer {
9-
text-align: center;
10-
flex: 1 1 auto;
1+
.mat-toolbar {
2+
font-size: 14px;
3+
height: 36px;
4+
font-family: 'Arial Narrow', Arial, sans-serif;
5+
text-align: center;
6+
}
7+
8+
.footer {
9+
text-align: center;
10+
flex: 1 1 auto;
1111
}

src/app/models.ts

Lines changed: 64 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ export class AppAdmin {
2727
export class Application {
2828
id: number;
2929
name: string;
30-
internal_scheme: string;
31-
redirect_https: boolean;
30+
internal_scheme: string;
31+
redirect_https: boolean;
3232
hsts_enabled: boolean;
3333
waf_enabled: boolean;
34-
shield_enabled: boolean;
35-
destinations: Destination[];
36-
domains: Domain[];
37-
ip_method: IPMethod;
34+
shield_enabled: boolean;
35+
destinations: Destination[];
36+
domains: Domain[];
37+
ip_method: IPMethod;
3838
description: string;
3939
oauth_required: boolean;
4040
session_seconds: number;
@@ -63,25 +63,25 @@ export class VipTarget {
6363
}
6464

6565
export enum IPMethod {
66-
REMOTE_ADDR = 1,
67-
X_Forwarded_For = 1 << 1,
68-
X_REAL_IP = 1 << 2,
69-
REAL_IP = 1 << 3
66+
REMOTE_ADDR = 1,
67+
X_Forwarded_For = 1 << 1,
68+
X_REAL_IP = 1 << 2,
69+
REAL_IP = 1 << 3
7070
}
7171

7272
export class Certificate {
7373
id: number;
7474
common_name: string;
7575
cert_content: string;
7676
priv_key_content: string;
77-
expire_time: number;
77+
expire_time: number;
7878
description: string;
7979
due_to_expire: boolean;
8080
}
8181

8282
export enum RouteType {
83-
Reverse_Proxy =1,
84-
Local_FastCGI =1 << 1,
83+
Reverse_Proxy = 1,
84+
Local_FastCGI = 1 << 1,
8585
Static_Website = 1 << 2
8686
}
8787

@@ -126,40 +126,40 @@ export class CCPolicy {
126126
stat_by_url: boolean;
127127
stat_by_ua: boolean;
128128
stat_by_cookie: boolean;
129-
is_enabled: boolean;
129+
is_enabled: boolean;
130130
}
131131

132132
export enum ChkPoint {
133-
Host = 1,
134-
IPAddress = 1 << 1,
135-
Method = 1 << 2,
136-
URLPath = 1 << 3,
137-
URLQuery = 1 << 4,
138-
FileExt = 1 << 5,
139-
// ValueLength = 1 << 6,
140-
GetPostKey = 1 << 7,
141-
GetPostValue = 1 << 8,
142-
UploadFileExt = 1 << 9,
143-
Referer = 1 << 10,
144-
CookieKey = 1 << 11,
145-
CookieValue = 1 << 12,
146-
UserAgent = 1 << 13,
147-
ContentType = 1 << 14,
148-
HeaderKey = 1 << 15,
149-
HeaderValue = 1 << 16,
150-
Proto = 1 << 17,
151-
ResponseStatusCode = 1 << 25,
152-
ResponseHeaderKey = 1 << 26,
153-
ResponseHeaderValue = 1 << 27,
154-
//ResponseBodyLength = 1 << 28,
155-
ResponseBody = 1 << 29
133+
Host = 1,
134+
IPAddress = 1 << 1,
135+
Method = 1 << 2,
136+
URLPath = 1 << 3,
137+
URLQuery = 1 << 4,
138+
FileExt = 1 << 5,
139+
// ValueLength = 1 << 6,
140+
GetPostKey = 1 << 7,
141+
GetPostValue = 1 << 8,
142+
UploadFileExt = 1 << 9,
143+
Referer = 1 << 10,
144+
CookieKey = 1 << 11,
145+
CookieValue = 1 << 12,
146+
UserAgent = 1 << 13,
147+
ContentType = 1 << 14,
148+
HeaderKey = 1 << 15,
149+
HeaderValue = 1 << 16,
150+
Proto = 1 << 17,
151+
ResponseStatusCode = 1 << 25,
152+
ResponseHeaderKey = 1 << 26,
153+
ResponseHeaderValue = 1 << 27,
154+
//ResponseBodyLength = 1 << 28,
155+
ResponseBody = 1 << 29
156156
}
157157

158158
export enum PolicyAction {
159-
BLOCK = 100,
160-
BYPASS_AND_LOG = 200,
159+
BLOCK = 100,
160+
BYPASS_AND_LOG = 200,
161161
CAPTCHA = 300,
162-
OK_PASS = 400
162+
OK_PASS = 400
163163
}
164164

165165
export class VulnType {
@@ -175,24 +175,25 @@ export class GroupPolicy {
175175
check_items: CheckItem[];
176176
hit_value: number;
177177
action: PolicyAction;
178-
is_enabled: boolean;
179-
178+
is_enabled: boolean;
179+
// extends
180+
unique_hash: string;
180181
}
181182

182183
export enum Operation {
183-
Regex_Match = 1,
184-
Equals_String_Case_Insensitive = 1 << 1,
185-
Greater_Than_Integer = 1 << 2,
186-
Equals_Integer = 1 << 3,
187-
Length_Greater_Than_Integer = 1 << 4,
188-
Regex_Not_Match = 1 << 5
184+
Regex_Match = 1,
185+
Equals_String_Case_Insensitive = 1 << 1,
186+
Greater_Than_Integer = 1 << 2,
187+
Equals_Integer = 1 << 3,
188+
Length_Greater_Than_Integer = 1 << 4,
189+
Regex_Not_Match = 1 << 5
189190
}
190191

191192
export class CheckItem {
192193
id: number;
193194
check_point: ChkPoint;
194195
operation: Operation;
195-
key_name: string;
196+
key_name: string;
196197
regex_policy: string;
197198
group_policy_id: number;
198199
}
@@ -287,26 +288,26 @@ export class CCLogsCount {
287288
}
288289

289290
export class LastRegexLogs {
290-
app_id : number;
291+
app_id: number;
291292
start_date: Date;
292293
end_date: Date;
293294
page_index: number;
294295
length: number;
295-
regex_logs: SimpleRegexHitLog[]=[];
296+
regex_logs: SimpleRegexHitLog[] = [];
296297
}
297298

298299
export class LastCCLogs {
299-
app_id : number;
300+
app_id: number;
300301
start_date: Date;
301302
end_date: Date;
302303
page_index: number;
303304
length: number;
304-
cc_logs: SimpleCCLog[]=[];
305+
cc_logs: SimpleCCLog[] = [];
305306
}
306307

307308
export class VulnStat {
308-
vuln_id : number;
309-
count : number;
309+
vuln_id: number;
310+
count: number;
310311
}
311312

312313
export class Server {
@@ -315,12 +316,12 @@ export class Server {
315316
username: string;
316317
password: string;
317318

318-
constructor(ip:string, port:string, username:string, password:string) {
319+
constructor(ip: string, port: string, username: string, password: string) {
319320
this.ip = ip;
320321
this.port = port;
321-
this.username =username;
322+
this.username = username;
322323
this.password = password;
323-
}
324+
}
324325
}
325326

326327
export class OAuthInfo {
@@ -332,14 +333,14 @@ export class OAuthInfo {
332333

333334
export class RefererHost {
334335
host: string;
335-
PV: number;
336-
UV: number;
336+
PV: number;
337+
UV: number;
337338
}
338339

339340
export class RefererURL {
340-
url: string;
341-
PV: number;
342-
UV: number;
341+
url: string;
342+
PV: number;
343+
UV: number;
343344
}
344345

345346
export class PopContent {

src/app/waf/waf.component.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,9 @@ button {
4141

4242
.center_column {
4343
justify-content: center;
44+
}
45+
46+
.float_right {
47+
display: flex;
48+
float: right;
4449
}

src/app/waf/waf.component.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@
44
<span *ngIf="applicationService.auth_user.is_super_admin">
55
<button mat-stroked-button i18n="@@add_policy" (click)="newGroupPolicy()">Add Policy</button>
66
</span>
7+
8+
<span *ngIf="applicationService.auth_user.is_super_admin">
9+
<button mat-stroked-button i18n="@@export_policies" (click)="exportWAF()">Export Policies</button>
10+
</span>
11+
12+
<span *ngIf="applicationService.auth_user.is_super_admin">
13+
<button mat-stroked-button i18n="@@import_policies" (click)="importWAF()">Import Policies</button>
14+
<input #fileInput type="file" (change)="readFile($event)" style="display: none;" />
15+
</span>
716
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
817
<mat-form-field appearance="none">
918
<input matInput (keyup)="applyFilter($event.target.value)" class="search_box" placeholder="Filter">
1019
</mat-form-field>
20+
1121
</div>
1222
<div class="mat-elevation-z8">
1323
<mat-table #table [dataSource]="globalRegexDataSource">

0 commit comments

Comments
 (0)