openwpm/OpenWPM

Tracking javascript events

Closed this issue · 4 comments

Hi,

I am trying to use openwpm to track user activities (js events). But I could not log/get js button click and other events. Does web-extension(js instrumentation) track the data such as button click and other other events ?

Hmm, I don't really know. I wrote some ideas in the openwpm matrix channel so maybe that helps.

Another thing that comes to mind is instrumenting the event you want to capture.
Does adding "SubmitEvent" or "MouseEvent" to the js_instrument_settings work? Or is that what you tried?

Thank you very much. I am trying to integrate openwpm webext-instrumentation for a webextension app. I want to track all js events so I am trying to use the js instrumentation for this. I have logged all the instrumentation data but it does not track js clicked and other js events. It logs 'javascript_cookies' data only. This is my config settings, I also added js_instrument_setting:

 let config = {
    navigation_instrument: true,
    cookie_instrument: true,
    js_instrument: true,
    js_instrument_settings:["SubmitEvent", "MouseEvent"],
    cleaned_js_instrument_settings: [
      {
        object: `window.CanvasRenderingContext2D.prototype`,
        instrumentedName: "CanvasRenderingContext2D",
        logSettings: {
          propertiesToInstrument: [],
          nonExistingPropertiesToInstrument: [],
          excludedProperties: [],
          logCallStack: false,
          logFunctionsAsStrings: false,
          logFunctionGets: false,
          preventSets: false,
          recursive: false,
          depth: 5,
        },
      },
    ],
    http_instrument: true,
    callstack_instrument: true,
    save_content: false,
    testing: true,
    browser_id: 0,
  };

Hey, please use the browser_params in python code to configure the JS Instrument and copy out the generated config. Otherwise you'd have to learn the full syntax for cleaned_js_instrument_settings, which does not seem like a good use of time.

Assign the ["SubmitEvent", "MouseEvent"] to the browser_params.js_instrument_settings here:

OpenWPM/demo.py

Lines 22 to 37 in 65c284b

browser_params = [BrowserParams(display_mode="headless") for _ in range(NUM_BROWSERS)]
# Update browser configuration (use this for per-browser settings)
for browser_param in browser_params:
# Record HTTP Requests and Responses
browser_param.http_instrument = True
# Record cookie changes
browser_param.cookie_instrument = True
# Record Navigations
browser_param.navigation_instrument = True
# Record JS Web API calls
browser_param.js_instrument = True
# Record the callstack of all WebRequests made
browser_param.callstack_instrument = True
# Record DNS resolution
browser_param.dns_instrument = True

js_instrument_settings get transformed into cleaned_js_instrument_settings by python code here

Thank you!