unblocked-web / double-agent

A test suite of common scraper detection techniques. See how detectable your scraper stack is.
MIT License
135 stars 10 forks source link

How to run? #18

Closed ghost closed 2 years ago

ghost commented 3 years ago

It seems to me that readme is missing a lot of information on how to test a scraper stack. I try to get to the "Follow setup directions print onto the console from this command" step.

Dockerfile

FROM node:12-slim
WORKDIR /double-agent

RUN apt-get update \
    && apt-get install -y \
        python3 \
        make \
        g++ \
        libpcap-dev \
        --no-install-recommends \
    && rm -rf /var/lib/apt/lists/* \
    && rm -rf /src/*.deb

CMD ["yarn"]

docker-compose.yml

version: '3.7'
services:
  doble-agent:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - .:/double-agent
    command: bash -c "yarn && cd runner && yarn start"
> docker-compose up

yarn install v1.22.5
[1/5] Validating package.json...
[2/5] Resolving packages...
warning workspace-aggregator-a784ca91-15cf-4966-b040-56286c6bc695 > @double-agent/browser-fingerprint > fingerprintjs2@2.1.2: Package has been renamed to @fingerprintjs/fingerprintjs. Install @fingerprintjs/fingerprintjs to get updates.
[3/5] Fetching packages...
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
success Saved lockfile.
$ yarn updateUseragent
yarn run v1.22.5
$ node node_modules/useragent/bin/update.js
Successfully fetched and generated new parsers from the internets.
Done in 2.43s.
Done in 176.48s.
yarn run v1.22.5
$ node index.js
Detection Suites Activated [
  '✓ tcp-ttl - Compares tcp packet values to the user agent OS',
  '✓ tls-clienthello - Looks at the tls handshake and compares to the proposed user agent OS',
  '✓ ip-address - Checks remote ip addresses and port ranges',
  '✓ http-cookies - Are cookies enabled? Are same-site, secure and other cookies correctly sent?',
  '✓ http-headers - Compares header order, capitalization and default values to normal (recorded) user agent values',
  '✓ http-loaded-assets - Does a request load expected assets? (css, images, ad networks)',
  '✓ http-user-agent - Checks how common a user agent is',
  '✓ browser-codecs - Test that the audio, video and WebRTC codecs match the given user agent',
  '✓ browser-dom - Test that the list of browser dom features matches the user agent',
  '✓ browser-fingerprint - Is the browser fingerprint the same on every execution?',
  '✓ browser-fonts - Does the font fingerprint match the operating system',
  '✓ browser-window-keys - Test that the list of browser window keys match the user agent',
  'x http-cache - Http caching headers sent in different conditions vs default user agent behavior',
  'x http-referrers - Referrer headers indicate browser came from a legitimate source',
  'x browser-javascript - Tests that javascript is enabled and has all/only EMCA features expected',
  'x browser-render - Detect nuances and capabilities for each browser rendering engine',
  'x browser-tampering - Detect when features have been tampered with to simulate a real browser',
  'x browser-vm - Detect when a browser is running in a VM',
  'x browser-webgl - Detect webGL graphics card and capabilities',
  'x user-interaction - Recording of order of exact steps performed (pages loaded, mouse movements/clicks, element interaction, typing)',
  'x user-mouse - Does the mouse move (scrolling, clicking, movement)?'
]

Booting up...
(node:183) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/double-agent/runner/detections-server/../certs/privkey.pem'
(node:183) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:183) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
calebjclark commented 3 years ago

The current repo is a very rough alpha version (more like pre-alpha, if that's possible... ha). We're in the final stage of a new version that is a significant upgrade. I'll let you know when that is pushed.

That said, the solution to fix your current problem is this:

Open the double-agent/runner/certs/ directory and run ./generate.sh to create the missing certs. That should solve your current problem, although there may be others that follow...

ghost commented 3 years ago

Gotcha. In such case waiting for the final release and trying to make the current version work meanwhile

calebjclark commented 3 years ago

Cool! Just curious, what is your use-case for DoubleAgent?

ghost commented 3 years ago

Want to test some puppeteer-based solutions found on web to see how good/bad they're in terms of being detected.

blakebyrnes commented 2 years ago

Docs added to readme