n0pe-sled / apache2-mod-rewrite-setup Goto Github PK
View Code? Open in Web Editor NEWQuickly Implement Mod-Rewrite in your infastructure
Quickly Implement Mod-Rewrite in your infastructure
I am using the mod rewrite script on some Malleable C2 profiles, one being https://github.com/rsmudge/Malleable-C2-Profiles/blob/master/normal/amazon.profile, and it produces invalid regex.
I feel it should be producing, ^/(/s/ref=nb_sb_noss_1/167-3294888-0262949/field-keywords=book|/N4215/adj/amzn.us.sr.ap)/?$
, which will properly redirect to my C2 (tested) on matching URI. The script as is produces !^/(/s/ref=nb_sb_noss_1/167-3294888-0262949/field-keywords=book|/N4215/adj/amzn.us.sr.ap)/?$
which doesn't match. (The trailing '!' is the difference which I believe is negating the result of the condition making it never hit the [P] ReWriteRule.)
The following patch made the amazon C2 profile work, but I haven't tested it on the others.
diff --git a/apache_redirector_setup.py b/apache_redirector_setup.py
index dd3083a..38c4efa 100644
--- a/apache_redirector_setup.py
+++ b/apache_redirector_setup.py
@@ -321,7 +321,7 @@ def validURI(uris, block_url, block_mode,server_root):
old.close()
if len(uris) == 1:
finalURI = uris[0]
- rule = 'RewriteCond %{REQUEST_URI} !^' + finalURI + '?$ [NC]\n'
+ rule = 'RewriteCond %{REQUEST_URI} ^' + finalURI + '?$ [NC]\n'
else:
for uri in uris:
if uri == uris[len(uris)-1]:
@@ -329,7 +329,7 @@ def validURI(uris, block_url, block_mode,server_root):
else:
finalURI += uri + "|"
- rule = 'RewriteCond %{REQUEST_URI} !^/(' + finalURI + ')/?$ [NC]\n'
+ rule = 'RewriteCond %{REQUEST_URI} ^/(' + finalURI + ')/?$ [NC]\n'
if block_mode == "redirect":
rule = rule + 'RewriteRule ^.*$ ' + block_url + '/? [L,R=302]\n'
elif block_mode == "proxy":
@@ -354,7 +354,7 @@ def validURI(uris, block_url, block_mode,server_root):
finalURI += uri + "|"
rule = "RewriteEngine On\n"
- rule += 'RewriteCond %{REQUEST_URI} !^/(' + finalURI + ')/?$ [NC]'
+ rule += 'RewriteCond %{REQUEST_URI} ^/(' + finalURI + ')/?$ [NC]'
if block_mode == "redirect":
rule = rule + 'RewriteRule ^.*$ ' + block_url + '/? [L,R=302]\n'
elif block_mode == "proxy":
Example python apache_redirector_setup.py --ip_blacklist="" --ip_blacklist="" --mobile_url="" --mobile_mode=proxy --allow_url="" --allow_mode="proxy"
has duplicate ip_blacklist args for using Cobalt Strike Malleable C2 profile command. Is this correct usage to load profile into script?
found in example usage section of script.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.