Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anonymization in/out #76

Merged
merged 28 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7aa6a2d
Delete compose-dev.yaml
AJun01 Jun 27, 2024
4d31657
feat(anonymization): improved anonymization feature
AJun01 Jun 29, 2024
ead1c9c
feat(anonymization): utilizing anonymization feature
AJun01 Jul 3, 2024
8ca9be9
fixed testing issue
AJun01 Jul 3, 2024
c49ffa7
feat(anonymization): improved testing
AJun01 Jul 4, 2024
c709f23
file rename: renamed simple-request(anonymized) to simple-request_ano…
AJun01 Jul 6, 2024
bd09f7e
merging branch 'develop-yujun' into AJun01/fix-issue-71 to fix the is…
AJun01 Jul 8, 2024
cc8fc07
Address PR review comments
AJun01 Jul 20, 2024
c38f915
Rename anonymized_Form-test.js to anonymized-Form-test.js
AJun01 Jul 20, 2024
7f66f82
Rename anonymized_JSON-test.js to anonymized-JSON-test.js
AJun01 Jul 20, 2024
0647219
Deleted gh.args(true) statement
AJun01 Jul 20, 2024
045b37f
Merge branch 'AJun01/fix-issue-71' of https://github.com/AJun01/devel…
AJun01 Jul 20, 2024
f21db70
feat(anonmization) refactored main.js and anonymizer.js
AJun01 Jul 25, 2024
90b6726
Address PR review comments
AJun01 Jul 28, 2024
7c52f85
minor fix
AJun01 Jul 29, 2024
96aa252
Rename anonymized-Form-test.js to anonymized-form-test.js
AJun01 Aug 2, 2024
c7d16f4
Rename anonymized-JSON-test.js to anonymized-json-test.js
AJun01 Aug 2, 2024
db957a0
minor fix: addressed comments and feedbacks
AJun01 Aug 2, 2024
bdaeb31
Merge branch 'AJun01/fix-issue-71' of https://github.com/AJun01/devel…
AJun01 Aug 2, 2024
029150e
removed console logs
AJun01 Aug 12, 2024
a933a97
fixed running error
AJun01 Aug 13, 2024
822239d
addressing the running error for simple-request-anonymized.js
AJun01 Aug 14, 2024
9d251fd
Added anonymization feature run test to README.md for Flexbench
AJun01 Aug 14, 2024
c31074b
fixed addressing running error
AJun01 Aug 14, 2024
11bae7c
improved anonymizeRequest in anonymizer
AJun01 Aug 14, 2024
d882d80
addresed minor issues
AJun01 Aug 17, 2024
234b4b9
addressed format and removed commented codes
AJun01 Aug 19, 2024
7c854da
addressed testing issues
AJun01 Aug 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,27 @@ If you want to uninstall just unlink it like this:
npm unlink flexbench
```

# How to turn on Anonymization Feature

After you cloned your exmaple, set the anonymize mode into true to turn on anonymization for the HTTPS response:

```
trafficSimulator.setAnonymization(true);
```

If you want to use existing example file to copy and paste over, please go to example folder and find simple-request-anonymized.js

You can always test the anonymization feature by running simple-request-anonymized.js:

```
node simple-request-anonymized.js
```

Features
========
* Throttling
* Clustering
* Anonymizing
* Set delay between requests
* Random or consecutive generation of requests
* Statistics aggregation
Expand Down
12 changes: 0 additions & 12 deletions compose-dev.yaml

This file was deleted.

79 changes: 79 additions & 0 deletions example/simple-request-anonymized.js
mariosk marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* Scenario:
* Generate requests towards specific domain
**/
var trafficSimulator = require('flexbench');


function runTest() {
trafficSimulator.debugMode(true);
trafficSimulator.testDuration(5);//-1 for infinite run
trafficSimulator.workers(1);
trafficSimulator.clients(2)
trafficSimulator.throttleRequests_bps(50000);//-1 for no throttling
trafficSimulator.randomDelayBetweenRequests('0.5-1.1');

//Anonymized
trafficSimulator.setAnonymization(true);

trafficSimulator.setFunc('request', requestFunc);

trafficSimulator.start();

trafficSimulator.events.on('end', function (stats) {
//This function will run on exit/stop, when worker has received a message to offload his stats to his master
//Get from stats object all exposed metrics
console.log('Traffic Simulator Results');
console.log('-------------------------');

var cArr = Object.keys(stats.counters);

for (var i = 0; i < cArr.length; i++) {
var key = cArr[i];
console.log('counter %s: %s ', key, stats.counters[key]);
}
console.log("Exiting..");
process.exit();
})



//stop test after specific period or condition\
setTimeout(function () {
trafficSimulator.stop();
}, 20 * 1000);

}

/**
* Create your generate request function here
* */
var requestFunc = function () {
//GENERATE REQUEST FUNCTION
var headers = {
"my-dummy-header": '1'
};
var options = {};
options['host'] = 'www.example.com';
options['port'] = '80';
options['path'] = '/';
options['method'] = 'GET';
if (headers) {
options['headers'] = headers;
}
//you can use the provided request function from HTS, in order 'catch'/count all response codes in a stats object
var req = trafficSimulator.request(options, function (response) {
console.log("Response: %s", response.statusCode);
response.setEncoding('utf8');
response.on('data', function (chunk) {
console.log(chunk.length)
console.log('hi: ', chunk.toString());
});
});

req.on('error', function (err) {
console.log('error:' + err.message);
});
}

runTest();
Loading