new: Initial commit for cookies tracking. No update on the view yet.

pull/62/head
Raphaël Vinot 2020-01-10 17:28:15 +01:00
parent 662bca6ed0
commit 0aaa814224
3 changed files with 21 additions and 12 deletions

10
Pipfile.lock generated
View File

@ -250,7 +250,7 @@
"har2tree": { "har2tree": {
"editable": true, "editable": true,
"git": "https://github.com/viper-framework/har2tree.git", "git": "https://github.com/viper-framework/har2tree.git",
"ref": "09421d04b9e3c985b61404bec828b4be7d892e01" "ref": "a486a8bd16ae3fd6ef69bedea6bcd0bfec572b16"
}, },
"hyperlink": { "hyperlink": {
"hashes": [ "hashes": [
@ -386,10 +386,10 @@
}, },
"pyasn1-modules": { "pyasn1-modules": {
"hashes": [ "hashes": [
"sha256:0c35a52e00b672f832e5846826f1fb7507907f7d52fba6faa9e3c4cbe874fe4b", "sha256:905f84c712230b2c592c19470d3ca8d552de726050d1d1716282a1f6146be65e",
"sha256:b6ada4f840fe51abf5a6bd545b45bf537bea62221fa0dde2e8a553ed9f06a4e3" "sha256:a50b808ffeb97cb3601dd25981f6b016cbb3d31fbf57a8b8a87428e6158d0c74"
], ],
"version": "==0.2.7" "version": "==0.2.8"
}, },
"pycparser": { "pycparser": {
"hashes": [ "hashes": [
@ -467,7 +467,7 @@
"scrapysplashwrapper": { "scrapysplashwrapper": {
"editable": true, "editable": true,
"git": "https://github.com/viper-framework/ScrapySplashWrapper.git", "git": "https://github.com/viper-framework/ScrapySplashWrapper.git",
"ref": "235b090d5b3024459ba9f91fa5f61660b4af5014" "ref": "3bd1786995c52ea75705940769d3f81979b4c830"
}, },
"service-identity": { "service-identity": {
"hashes": [ "hashes": [

View File

@ -139,8 +139,6 @@ class Lookyloo():
with open((report_dir / 'meta'), 'r') as f: with open((report_dir / 'meta'), 'r') as f:
meta = json.load(f) meta = json.load(f)
ct = CrawledTree(har_files) ct = CrawledTree(har_files)
ct.find_parents()
ct.join_trees()
temp = tempfile.NamedTemporaryFile(prefix='lookyloo', delete=False) temp = tempfile.NamedTemporaryFile(prefix='lookyloo', delete=False)
pickle.dump(ct, temp) pickle.dump(ct, temp)
temp.close() temp.close()

View File

@ -177,17 +177,20 @@ function hostnode_click(d) {
var url_entries = overlay_hostname.append('svg'); var url_entries = overlay_hostname.append('svg');
var interval_entries = 40; var interval_entries = 10;
urls.forEach((url, index, array) => { urls.forEach((url, index, array) => {
var jdata = JSON.parse(url); var jdata = JSON.parse(url);
var url_data = url_entries.append('svg') var url_data = url_entries.append('svg')
.attr('class', 'url_data'); .attr('class', 'url_data');
url_data.datum({'data': jdata}); url_data.datum({'data': jdata});
url_data.append(d => text_entry(left_margin, top_margin + overlay_header_height + (interval_entries * index), urlnode_click, d)); url_data.append(d => text_entry(left_margin, top_margin + overlay_header_height + (interval_entries * index), urlnode_click, d));
url_data.append(d => icon_list(left_margin + 5, top_margin + 20 + overlay_header_height + (interval_entries * index), d)); url_data.append(d => icon_list(left_margin + 5, top_margin + 20 + overlay_header_height + (interval_entries * index), d, url_view=true));
}); });
var cur_url_data_height = 0;
url_entries.selectAll('.url_data').each(function(p, j){ url_entries.selectAll('.url_data').each(function(p, j){
d3.select(this).attr('y', cur_url_data_height);
cur_url_data_height += d3.select(this).node().getBBox().height;
var cur_icon_list_len = 0; var cur_icon_list_len = 0;
// set position of icons based of their length // set position of icons based of their length
d3.select(this).selectAll('.icon').each(function(p, j){ d3.select(this).selectAll('.icon').each(function(p, j){
@ -255,6 +258,9 @@ function icon(key, icon_path, d, icon_size){
iconContent.datum(d); iconContent.datum(d);
iconContent.filter(d => { iconContent.filter(d => {
if (['cookies_sent', 'cookies_received'].includes(key)) {
return false;
}
if (typeof d.data[key] === 'boolean') { if (typeof d.data[key] === 'boolean') {
has_icon = d.data[key]; has_icon = d.data[key];
} else if (typeof d.data[key] === 'number') { } else if (typeof d.data[key] === 'number') {
@ -270,6 +276,9 @@ function icon(key, icon_path, d, icon_size){
iconContent.filter(d => { iconContent.filter(d => {
if (['cookies_sent', 'cookies_received'].includes(key)) {
return false;
}
if (typeof d.data[key] === 'boolean') { if (typeof d.data[key] === 'boolean') {
return false; return false;
// return d.data[key]; // return d.data[key];
@ -286,13 +295,14 @@ function icon(key, icon_path, d, icon_size){
.style("font-size", "10px") .style("font-size", "10px")
.attr('x', icon_size + 1) .attr('x', icon_size + 1)
.text(d => d.to_print); .text(d => d.to_print);
if (has_icon) { if (has_icon) {
return iconContent.node(); return iconContent.node();
} }
return false; return false;
}; };
function icon_list(relative_x_pos, relative_y_pos, d) { function icon_list(relative_x_pos, relative_y_pos, d, url_view=false) {
var icon_size = 16; var icon_size = 16;
// Put all the icone in one sub svg document // Put all the icone in one sub svg document
@ -312,14 +322,15 @@ function icon_list(relative_x_pos, relative_y_pos, d) {
['unknown_mimetype', "/static/wtf.png"], ['unknown_mimetype', "/static/wtf.png"],
['video', "/static/video.png"], ['video', "/static/video.png"],
['request_cookie', "/static/cookie_read.png"], ['request_cookie', "/static/cookie_read.png"],
['cookies_sent', "/static/cookie_read.png"],
['response_cookie', "/static/cookie_received.png"], ['response_cookie', "/static/cookie_received.png"],
['cookies_received', "/static/cookie_received.png"],
['redirect', "/static/redirect.png"], ['redirect', "/static/redirect.png"],
['redirect_to_nothing', "/static/cookie_in_url.png"] ['redirect_to_nothing', "/static/cookie_in_url.png"]
]; ];
nb_icons = 0
icon_options.forEach(entry => { icon_options.forEach(entry => {
bloc = icon(entry[0], entry[1], d, icon_size); bloc = icon(entry[0], entry[1], d, icon_size, url_view);
if (bloc){ if (bloc){
icons.append(() => bloc); icons.append(() => bloc);
}; };