Skip to content

Commit 9d203d8

Browse files
authored
Merge pull request #687 from allproxy/v3-29-0
V3 29 0: Filter on key:value - eg, latency:>30
2 parents e346df0 + 0d747b5 commit 9d203d8

File tree

6 files changed

+57
-9
lines changed

6 files changed

+57
-9
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ MITM debugging proxy with a web GUI to view and modify all of the HTTP and HTTPS
88

99
### Install
1010

11-
> Mac: **[allproxy.dmg](https://github.com/allproxy/allproxy/releases/download/v3.28.0/allproxy-3.28.0-x64.dmg)**
11+
> Mac: **[allproxy.dmg](https://github.com/allproxy/allproxy/releases/download/v3.29.0/allproxy-3.29.0-x64.dmg)**
1212
13-
> RedHat: **[allproxy.rpm](https://github.com/allproxy/allproxy/releases/download/v3.28.0/allproxy-3.28.0-1.x86_64.rpm)**
13+
> RedHat: **[allproxy.rpm](https://github.com/allproxy/allproxy/releases/download/v3.29.0/allproxy-3.29.0-1.x86_64.rpm)**
1414
15-
> Ubuntu: **[allproxy.deb](https://github.com/allproxy/allproxy/releases/download/v3.28.0/allproxy_3.28.0_amd64.deb)**
15+
> Ubuntu: **[allproxy.deb](https://github.com/allproxy/allproxy/releases/download/v3.29.0/allproxy_3.29.0_amd64.deb)**
1616
17-
> Windows: **[Setup.exe](https://github.com/allproxy/allproxy/releases/download/v3.28.0/allproxy-3.28.0.Setup.exe)**
17+
> Windows: **[Setup.exe](https://github.com/allproxy/allproxy/releases/download/v3.29.0/allproxy-3.29.0.Setup.exe)**
1818
1919
> Other install options:
2020
> 1. Install NPM package: **npm install -g allproxy**

client/src/App.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,14 @@ body {
8181
}
8282
}
8383

84-
.react-tagsinput,
85-
.react-tagsinput input,
8684
.header__filter-input,
8785
.header__filter-input input {
86+
color: rgba(232, 230, 227);
87+
background-color: #444444;
88+
}
89+
90+
.react-tagsinput,
91+
.react-tagsinput input {
8892
color: rgba(232, 230, 227) !important;
8993
background-color: #444444 !important;
9094
}

client/src/store/APFileSystem.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export default class APFileSystem {
6060
// exists
6161
public async exists(path: string): Promise<boolean> {
6262
return new Promise<boolean>((resolve) => {
63+
setTimeout(() => resolve(false), 5000);
6364
this.socket?.emit('exists', path, (exists: boolean) => {
6465
resolve(exists);
6566
});

client/src/store/FilterStore.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,51 @@ export default class FilterStore {
379379
}
380380
}
381381

382+
private isJsonKeyValueMatch(key: string, value: string, operator: string, json: { [key: string]: any }): boolean {
383+
const lowerKey = key.toLowerCase();
384+
const upperKey = key.toUpperCase();
385+
let jsonValue = json[lowerKey];
386+
if (jsonValue === undefined) jsonValue = json[upperKey];
387+
388+
if (jsonValue === undefined) return false;
389+
if (typeof jsonValue === 'number') {
390+
const float = parseFloat(value);
391+
const int = parseInt(value);
392+
if (!isNaN(float)) {
393+
return eval(jsonValue + operator + float);
394+
}
395+
if (!isNaN(int)) {
396+
return eval(jsonValue + operator + int);
397+
}
398+
return false;
399+
}
400+
return eval(jsonValue + operator + value);
401+
}
402+
382403
private isMessageFiltered(needle: string, messageStore: MessageStore) {
383404
const message = messageStore.getMessage();
405+
406+
// Check for JSON key:value syntax
407+
const i = needle.indexOf(':');
408+
if (i !== -1 && needle.length > i + 1 && needle.substring(i + 1).indexOf(':') === -1) {
409+
if (typeof message.responseBody === 'string') {
410+
return true;
411+
} else {
412+
const key = needle.substring(0, i);
413+
let value = needle.substring(i + 1);
414+
let operator = '==';
415+
if (value.startsWith('>') || value.startsWith('<')) {
416+
operator = value.substring(0, 1);
417+
value = value.substring(1);
418+
if (value.startsWith('=')) {
419+
operator += value.substring(0, 1);
420+
value = value.substring(1);
421+
}
422+
}
423+
return !this.isJsonKeyValueMatch(key, value, operator, message.responseBody as { [key: string]: any });
424+
}
425+
}
426+
384427
if (message.proxyConfig && this.isMatch(needle, message.proxyConfig.protocol)) return false;
385428
if (this.isMatch(needle, message.protocol)) return false;
386429
if (message.protocol !== 'log:') {

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "allproxy",
3-
"version": "3.28.0",
3+
"version": "3.29.0",
44
"description": "AllProxy: MITM HTTP Debugging Tool.",
55
"keywords": [
66
"proxy",

0 commit comments

Comments
 (0)