Skip to content

Commit

Permalink
Merge pull request #10 from Anof-cyber/fixed-command-line-character-l…
Browse files Browse the repository at this point in the history
…imit

Fixed command line character limit
  • Loading branch information
Anof-cyber authored Jul 3, 2024
2 parents a5e51d3 + 89d13b3 commit c2e8aef
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pycript.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

errorlogtextbox = None
errorlogcheckbox = None
VERSION = "Version 0.3"
VERSION = "Version 0.4"

class BurpExtender(IBurpExtender, ITab,IMessageEditorTabFactory,IContextMenuFactory, IMessageEditorController, AbstractTableModel,IHttpListener):

Expand Down
24 changes: 20 additions & 4 deletions pycript/execution.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
import subprocess
from .gui import logerrors
import os
import tempfile
from os import remove
import json

def execute_command(selectedlang, path, data, headervalue=None):
try:

content = {
"data": data
}
if headervalue is not None:
content["header"] = headervalue

with tempfile.NamedTemporaryFile(delete=False, mode='w') as temp_file:
json.dump(content, temp_file)
temp_file_path = temp_file.name


command = []
if selectedlang:
command.append('"' + selectedlang + '"')

command.extend(['"' + path + '"',"-d", data])
if path.endswith(".jar"):
command.extend(["-jar"])

if headervalue is not None:
command.extend(["-h", headervalue])
command.extend(['"' + path + '"',"-d", temp_file_path])

command_str = ' '.join(command)
logerrors("$ " + command_str)
Expand All @@ -23,6 +38,7 @@ def execute_command(selectedlang, path, data, headervalue=None):
universal_newlines=True
)
output, error = process.communicate()
remove(temp_file_path)

if process.returncode != 0:
logerrors(error.strip())
Expand Down

0 comments on commit c2e8aef

Please sign in to comment.