Giter Club home page Giter Club logo

apache2-mod-rewrite-setup's Issues

Some profiles produce invalid regex

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 useage duplicate args and possible example error

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.