We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
'from pwn import *' fails when one of the command line args is a Base64 string (or has more than one equal sign)
The argument parsing functionality invoked by `from pwn import *` causes an error when one of the command line arguments has more than one equal sign:
`echo "from pwn import *\nprint('hello world')" > test.py`
`python test.py afdsa==`

```
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    from pwn import *
  File "/usr/local/lib/python2.7/site-packages/pwn/__init__.py", line 6, in <module>
    pwnlib.args.initialize()
  File "/usr/local/lib/python2.7/site-packages/pwnlib/args.py", line 197, in initialize
    arg, value = arg.split('=')
ValueError: too many values to unpack
```

https://github.com/Gallopsled/pwntools/blob/dev/pwnlib/args.py#L197 probably just needs to be changed to `if arg.count("=") == 1:`

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pwnlib/args.py`
Content:
```
1 
2 #!/usr/bin/env python2
3 """
4 Pwntools exposes several magic command-line arguments and environment
5 variables when operating in `from pwn import *` mode.
6 
7 The arguments extracted from the command-line and removed from ``sys.argv``.
8 
9 Arguments can be set by appending them to the command-line, or setting
10 them in the environment prefixed by ``PWNLIB_``.
11 
12 The easiest example is to enable more verbose debugging.  Just set ``DEBUG``.
13 
14 .. code-block:: bash
15 
16     $ PWNLIB_DEBUG=1 python exploit.py
17     $ python exploit.py DEBUG
18 
19 These arguments are automatically extracted, regardless of their name, and
20 exposed via :mod:`pwnlib.args.args`, which is exposed as the global variable
21 :data:`args`.  Arguments which ``pwntools`` reserves internally are not exposed
22 this way.
23 
24 .. code-block:: bash
25 
26     $ python -c 'from pwn import *; print args' A=1 B=Hello HOST=1.2.3.4 DEBUG
27     defaultdict(<type 'str'>, {'A': '1', 'HOST': '1.2.3.4', 'B': 'Hello'})
28 
29 This is very useful for conditional code, for example determining whether to
30 run an exploit locally or to connect to a remote server.  Arguments which are
31 not specified evaluate to an empty string.
32 
33 .. code-block:: python
34 
35     if args['REMOTE']:
36         io = remote('exploitme.com', 4141)
37     else:
38         io = process('./pwnable')
39 
40 Arguments can also be accessed directly with the dot operator, e.g.:
41 
42 .. code-block:: python
43 
44     if args.REMOTE:
45         ...
46 
47 Any undefined arguments evaluate to an empty string, ``''``.
48 
49 The full list of supported "magic arguments" and their effects are listed
50 below.
51 
52 """
53 from __future__ import absolute_import
54 
55 import collections
56 import logging
57 import os
58 import string
59 import sys
60 
61 from pwnlib import term
62 from pwnlib.context import context
63 
64 class PwnlibArgs(collections.defaultdict):
65     def __getattr__(self, attr):
66         return self[attr]
67 
68 args = PwnlibArgs(str)
69 term_mode  = True
70 env_prefix = 'PWNLIB_'
71 free_form  = True
72 
73 # Check to see if we were invoked as one of the 'pwn xxx' scripts.
74 # If so, we don't want to remove e.g. "SYS_" from the end of the command
75 # line, as this breaks things like constgrep.
76 import pwnlib.commandline
77 basename = os.path.basename(sys.argv[0])
78 
79 if basename == 'pwn' or basename in pwnlib.commandline.__all__:
80     free_form = False
81 
82 
83 def isident(s):
84     """
85     Helper function to check whether a string is a valid identifier,
86     as passed in on the command-line.
87     """
88     first = string.uppercase + '_'
89     body = string.digits + first
90     if not s:
91         return False
92     if s[0] not in first:
93         return False
94     if not all(c in body for c in s[1:]):
95         return False
96     return True
97 
98 def asbool(s):
99     """
100     Convert a string to its boolean value
101     """
102     if   s.lower() == 'true':
103         return True
104     elif s.lower() == 'false':
105         return False
106     elif s.isdigit():
107         return bool(int(s))
108     else:
109         raise ValueError('must be integer or boolean: %r' % s)
110 
111 def LOG_LEVEL(x):
112     """Sets the logging verbosity used via ``context.log_level``,
113     e.g. ``LOG_LEVEL=debug``.
114     """
115     with context.local(log_level=x):
116         context.defaults['log_level']=context.log_level
117 
118 def LOG_FILE(x):
119     """Sets a log file to be used via ``context.log_file``, e.g.
120     ``LOG_FILE=./log.txt``"""
121     context.log_file=x
122 
123 def SILENT(x):
124     """Sets the logging verbosity to ``error`` which silences most
125     output."""
126     LOG_LEVEL('error')
127 
128 def DEBUG(x):
129     """Sets the logging verbosity to ``debug`` which displays much
130     more information, including logging each byte sent by tubes."""
131     LOG_LEVEL('debug')
132 
133 def NOTERM(v):
134     """Disables pretty terminal settings and animations."""
135     if asbool(v):
136         global term_mode
137         term_mode = False
138 
139 def TIMEOUT(v):
140     """Sets a timeout for tube operations (in seconds) via
141     ``context.timeout``, e.g. ``TIMEOUT=30``"""
142     context.defaults['timeout'] = int(v)
143 
144 def RANDOMIZE(v):
145     """Enables randomization of various pieces via ``context.randomize``"""
146     context.defaults['randomize'] = asbool(v)
147 
148 def NOASLR(v):
149     """Disables ASLR via ``context.aslr``"""
150     context.defaults['aslr'] = not asbool(v)
151 
152 def NOPTRACE(v):
153     """Disables facilities which require ``ptrace`` such as ``gdb.attach()``
154     statements, via ``context.noptrace``."""
155     context.defaults['noptrace'] = asbool(v)
156 
157 def STDERR(v):
158     """Sends logging to ``stderr`` by default, instead of ``stdout``"""
159     context.log_console = sys.stderr
160 
161 hooks = {
162     'LOG_LEVEL': LOG_LEVEL,
163     'LOG_FILE': LOG_FILE,
164     'DEBUG': DEBUG,
165     'NOTERM': NOTERM,
166     'SILENT': SILENT,
167     'RANDOMIZE': RANDOMIZE,
168     'TIMEOUT': TIMEOUT,
169     'NOASLR': NOASLR,
170     'NOPTRACE': NOPTRACE,
171     'STDERR': STDERR,
172 }
173 
174 def initialize():
175     global args, term_mode
176 
177     # Hack for readthedocs.org
178     if 'READTHEDOCS' in os.environ:
179         os.environ['PWNLIB_NOTERM'] = '1'
180 
181     for k, v in os.environ.items():
182         if not k.startswith(env_prefix):
183             continue
184         k = k[len(env_prefix):]
185 
186         if k in hooks:
187             hooks[k](v)
188         elif isident(k):
189             args[k] = v
190 
191     argv = sys.argv[:]
192     for arg in sys.argv[:]:
193         orig  = arg
194         value = 'True'
195 
196         if '=' in arg:
197             arg, value = arg.split('=')
198 
199         if arg in hooks:
200             sys.argv.remove(orig)
201             hooks[arg](value)
202 
203         elif free_form and isident(arg):
204             sys.argv.remove(orig)
205             args[arg] = value
206 
207     if term_mode:
208         term.init()
209
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pwnlib/args.py b/pwnlib/args.py
--- a/pwnlib/args.py
+++ b/pwnlib/args.py
@@ -194,7 +194,7 @@
         value = 'True'
 
         if '=' in arg:
-            arg, value = arg.split('=')
+            arg, value = arg.split('=', 1)
 
         if arg in hooks:
             sys.argv.remove(orig)

{"golden_diff": "diff --git a/pwnlib/args.py b/pwnlib/args.py\n--- a/pwnlib/args.py\n+++ b/pwnlib/args.py\n@@ -194,7 +194,7 @@\n         value = 'True'\n \n         if '=' in arg:\n-            arg, value = arg.split('=')\n+            arg, value = arg.split('=', 1)\n \n         if arg in hooks:\n             sys.argv.remove(orig)\n", "issue": "'from pwn import *' fails when one of the command line args is a Base64 string (or has more than one equal sign)\nThe argument parsing functionality invoked by `from pwn import *` causes an error when one of the command line arguments has more than one equal sign:\r\n`echo \"from pwn import *\\nprint('hello world')\" > test.py`\r\n`python test.py afdsa==`\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"test.py\", line 1, in <module>\r\n    from pwn import *\r\n  File \"/usr/local/lib/python2.7/site-packages/pwn/__init__.py\", line 6, in <module>\r\n    pwnlib.args.initialize()\r\n  File \"/usr/local/lib/python2.7/site-packages/pwnlib/args.py\", line 197, in initialize\r\n    arg, value = arg.split('=')\r\nValueError: too many values to unpack\r\n```\r\n\r\nhttps://github.com/Gallopsled/pwntools/blob/dev/pwnlib/args.py#L197 probably just needs to be changed to `if arg.count(\"=\") == 1:`\n", "before_files": [{"content": "\n#!/usr/bin/env python2\n\"\"\"\nPwntools exposes several magic command-line arguments and environment\nvariables when operating in `from pwn import *` mode.\n\nThe arguments extracted from the command-line and removed from ``sys.argv``.\n\nArguments can be set by appending them to the command-line, or setting\nthem in the environment prefixed by ``PWNLIB_``.\n\nThe easiest example is to enable more verbose debugging.  Just set ``DEBUG``.\n\n.. code-block:: bash\n\n    $ PWNLIB_DEBUG=1 python exploit.py\n    $ python exploit.py DEBUG\n\nThese arguments are automatically extracted, regardless of their name, and\nexposed via :mod:`pwnlib.args.args`, which is exposed as the global variable\n:data:`args`.  Arguments which ``pwntools`` reserves internally are not exposed\nthis way.\n\n.. code-block:: bash\n\n    $ python -c 'from pwn import *; print args' A=1 B=Hello HOST=1.2.3.4 DEBUG\n    defaultdict(<type 'str'>, {'A': '1', 'HOST': '1.2.3.4', 'B': 'Hello'})\n\nThis is very useful for conditional code, for example determining whether to\nrun an exploit locally or to connect to a remote server.  Arguments which are\nnot specified evaluate to an empty string.\n\n.. code-block:: python\n\n    if args['REMOTE']:\n        io = remote('exploitme.com', 4141)\n    else:\n        io = process('./pwnable')\n\nArguments can also be accessed directly with the dot operator, e.g.:\n\n.. code-block:: python\n\n    if args.REMOTE:\n        ...\n\nAny undefined arguments evaluate to an empty string, ``''``.\n\nThe full list of supported \"magic arguments\" and their effects are listed\nbelow.\n\n\"\"\"\nfrom __future__ import absolute_import\n\nimport collections\nimport logging\nimport os\nimport string\nimport sys\n\nfrom pwnlib import term\nfrom pwnlib.context import context\n\nclass PwnlibArgs(collections.defaultdict):\n    def __getattr__(self, attr):\n        return self[attr]\n\nargs = PwnlibArgs(str)\nterm_mode  = True\nenv_prefix = 'PWNLIB_'\nfree_form  = True\n\n# Check to see if we were invoked as one of the 'pwn xxx' scripts.\n# If so, we don't want to remove e.g. \"SYS_\" from the end of the command\n# line, as this breaks things like constgrep.\nimport pwnlib.commandline\nbasename = os.path.basename(sys.argv[0])\n\nif basename == 'pwn' or basename in pwnlib.commandline.__all__:\n    free_form = False\n\n\ndef isident(s):\n    \"\"\"\n    Helper function to check whether a string is a valid identifier,\n    as passed in on the command-line.\n    \"\"\"\n    first = string.uppercase + '_'\n    body = string.digits + first\n    if not s:\n        return False\n    if s[0] not in first:\n        return False\n    if not all(c in body for c in s[1:]):\n        return False\n    return True\n\ndef asbool(s):\n    \"\"\"\n    Convert a string to its boolean value\n    \"\"\"\n    if   s.lower() == 'true':\n        return True\n    elif s.lower() == 'false':\n        return False\n    elif s.isdigit():\n        return bool(int(s))\n    else:\n        raise ValueError('must be integer or boolean: %r' % s)\n\ndef LOG_LEVEL(x):\n    \"\"\"Sets the logging verbosity used via ``context.log_level``,\n    e.g. ``LOG_LEVEL=debug``.\n    \"\"\"\n    with context.local(log_level=x):\n        context.defaults['log_level']=context.log_level\n\ndef LOG_FILE(x):\n    \"\"\"Sets a log file to be used via ``context.log_file``, e.g.\n    ``LOG_FILE=./log.txt``\"\"\"\n    context.log_file=x\n\ndef SILENT(x):\n    \"\"\"Sets the logging verbosity to ``error`` which silences most\n    output.\"\"\"\n    LOG_LEVEL('error')\n\ndef DEBUG(x):\n    \"\"\"Sets the logging verbosity to ``debug`` which displays much\n    more information, including logging each byte sent by tubes.\"\"\"\n    LOG_LEVEL('debug')\n\ndef NOTERM(v):\n    \"\"\"Disables pretty terminal settings and animations.\"\"\"\n    if asbool(v):\n        global term_mode\n        term_mode = False\n\ndef TIMEOUT(v):\n    \"\"\"Sets a timeout for tube operations (in seconds) via\n    ``context.timeout``, e.g. ``TIMEOUT=30``\"\"\"\n    context.defaults['timeout'] = int(v)\n\ndef RANDOMIZE(v):\n    \"\"\"Enables randomization of various pieces via ``context.randomize``\"\"\"\n    context.defaults['randomize'] = asbool(v)\n\ndef NOASLR(v):\n    \"\"\"Disables ASLR via ``context.aslr``\"\"\"\n    context.defaults['aslr'] = not asbool(v)\n\ndef NOPTRACE(v):\n    \"\"\"Disables facilities which require ``ptrace`` such as ``gdb.attach()``\n    statements, via ``context.noptrace``.\"\"\"\n    context.defaults['noptrace'] = asbool(v)\n\ndef STDERR(v):\n    \"\"\"Sends logging to ``stderr`` by default, instead of ``stdout``\"\"\"\n    context.log_console = sys.stderr\n\nhooks = {\n    'LOG_LEVEL': LOG_LEVEL,\n    'LOG_FILE': LOG_FILE,\n    'DEBUG': DEBUG,\n    'NOTERM': NOTERM,\n    'SILENT': SILENT,\n    'RANDOMIZE': RANDOMIZE,\n    'TIMEOUT': TIMEOUT,\n    'NOASLR': NOASLR,\n    'NOPTRACE': NOPTRACE,\n    'STDERR': STDERR,\n}\n\ndef initialize():\n    global args, term_mode\n\n    # Hack for readthedocs.org\n    if 'READTHEDOCS' in os.environ:\n        os.environ['PWNLIB_NOTERM'] = '1'\n\n    for k, v in os.environ.items():\n        if not k.startswith(env_prefix):\n            continue\n        k = k[len(env_prefix):]\n\n        if k in hooks:\n            hooks[k](v)\n        elif isident(k):\n            args[k] = v\n\n    argv = sys.argv[:]\n    for arg in sys.argv[:]:\n        orig  = arg\n        value = 'True'\n\n        if '=' in arg:\n            arg, value = arg.split('=')\n\n        if arg in hooks:\n            sys.argv.remove(orig)\n            hooks[arg](value)\n\n        elif free_form and isident(arg):\n            sys.argv.remove(orig)\n            args[arg] = value\n\n    if term_mode:\n        term.init()\n", "path": "pwnlib/args.py"}], "after_files": [{"content": "\n#!/usr/bin/env python2\n\"\"\"\nPwntools exposes several magic command-line arguments and environment\nvariables when operating in `from pwn import *` mode.\n\nThe arguments extracted from the command-line and removed from ``sys.argv``.\n\nArguments can be set by appending them to the command-line, or setting\nthem in the environment prefixed by ``PWNLIB_``.\n\nThe easiest example is to enable more verbose debugging.  Just set ``DEBUG``.\n\n.. code-block:: bash\n\n    $ PWNLIB_DEBUG=1 python exploit.py\n    $ python exploit.py DEBUG\n\nThese arguments are automatically extracted, regardless of their name, and\nexposed via :mod:`pwnlib.args.args`, which is exposed as the global variable\n:data:`args`.  Arguments which ``pwntools`` reserves internally are not exposed\nthis way.\n\n.. code-block:: bash\n\n    $ python -c 'from pwn import *; print args' A=1 B=Hello HOST=1.2.3.4 DEBUG\n    defaultdict(<type 'str'>, {'A': '1', 'HOST': '1.2.3.4', 'B': 'Hello'})\n\nThis is very useful for conditional code, for example determining whether to\nrun an exploit locally or to connect to a remote server.  Arguments which are\nnot specified evaluate to an empty string.\n\n.. code-block:: python\n\n    if args['REMOTE']:\n        io = remote('exploitme.com', 4141)\n    else:\n        io = process('./pwnable')\n\nArguments can also be accessed directly with the dot operator, e.g.:\n\n.. code-block:: python\n\n    if args.REMOTE:\n        ...\n\nAny undefined arguments evaluate to an empty string, ``''``.\n\nThe full list of supported \"magic arguments\" and their effects are listed\nbelow.\n\n\"\"\"\nfrom __future__ import absolute_import\n\nimport collections\nimport logging\nimport os\nimport string\nimport sys\n\nfrom pwnlib import term\nfrom pwnlib.context import context\n\nclass PwnlibArgs(collections.defaultdict):\n    def __getattr__(self, attr):\n        return self[attr]\n\nargs = PwnlibArgs(str)\nterm_mode  = True\nenv_prefix = 'PWNLIB_'\nfree_form  = True\n\n# Check to see if we were invoked as one of the 'pwn xxx' scripts.\n# If so, we don't want to remove e.g. \"SYS_\" from the end of the command\n# line, as this breaks things like constgrep.\nimport pwnlib.commandline\nbasename = os.path.basename(sys.argv[0])\n\nif basename == 'pwn' or basename in pwnlib.commandline.__all__:\n    free_form = False\n\n\ndef isident(s):\n    \"\"\"\n    Helper function to check whether a string is a valid identifier,\n    as passed in on the command-line.\n    \"\"\"\n    first = string.uppercase + '_'\n    body = string.digits + first\n    if not s:\n        return False\n    if s[0] not in first:\n        return False\n    if not all(c in body for c in s[1:]):\n        return False\n    return True\n\ndef asbool(s):\n    \"\"\"\n    Convert a string to its boolean value\n    \"\"\"\n    if   s.lower() == 'true':\n        return True\n    elif s.lower() == 'false':\n        return False\n    elif s.isdigit():\n        return bool(int(s))\n    else:\n        raise ValueError('must be integer or boolean: %r' % s)\n\ndef LOG_LEVEL(x):\n    \"\"\"Sets the logging verbosity used via ``context.log_level``,\n    e.g. ``LOG_LEVEL=debug``.\n    \"\"\"\n    with context.local(log_level=x):\n        context.defaults['log_level']=context.log_level\n\ndef LOG_FILE(x):\n    \"\"\"Sets a log file to be used via ``context.log_file``, e.g.\n    ``LOG_FILE=./log.txt``\"\"\"\n    context.log_file=x\n\ndef SILENT(x):\n    \"\"\"Sets the logging verbosity to ``error`` which silences most\n    output.\"\"\"\n    LOG_LEVEL('error')\n\ndef DEBUG(x):\n    \"\"\"Sets the logging verbosity to ``debug`` which displays much\n    more information, including logging each byte sent by tubes.\"\"\"\n    LOG_LEVEL('debug')\n\ndef NOTERM(v):\n    \"\"\"Disables pretty terminal settings and animations.\"\"\"\n    if asbool(v):\n        global term_mode\n        term_mode = False\n\ndef TIMEOUT(v):\n    \"\"\"Sets a timeout for tube operations (in seconds) via\n    ``context.timeout``, e.g. ``TIMEOUT=30``\"\"\"\n    context.defaults['timeout'] = int(v)\n\ndef RANDOMIZE(v):\n    \"\"\"Enables randomization of various pieces via ``context.randomize``\"\"\"\n    context.defaults['randomize'] = asbool(v)\n\ndef NOASLR(v):\n    \"\"\"Disables ASLR via ``context.aslr``\"\"\"\n    context.defaults['aslr'] = not asbool(v)\n\ndef NOPTRACE(v):\n    \"\"\"Disables facilities which require ``ptrace`` such as ``gdb.attach()``\n    statements, via ``context.noptrace``.\"\"\"\n    context.defaults['noptrace'] = asbool(v)\n\ndef STDERR(v):\n    \"\"\"Sends logging to ``stderr`` by default, instead of ``stdout``\"\"\"\n    context.log_console = sys.stderr\n\nhooks = {\n    'LOG_LEVEL': LOG_LEVEL,\n    'LOG_FILE': LOG_FILE,\n    'DEBUG': DEBUG,\n    'NOTERM': NOTERM,\n    'SILENT': SILENT,\n    'RANDOMIZE': RANDOMIZE,\n    'TIMEOUT': TIMEOUT,\n    'NOASLR': NOASLR,\n    'NOPTRACE': NOPTRACE,\n    'STDERR': STDERR,\n}\n\ndef initialize():\n    global args, term_mode\n\n    # Hack for readthedocs.org\n    if 'READTHEDOCS' in os.environ:\n        os.environ['PWNLIB_NOTERM'] = '1'\n\n    for k, v in os.environ.items():\n        if not k.startswith(env_prefix):\n            continue\n        k = k[len(env_prefix):]\n\n        if k in hooks:\n            hooks[k](v)\n        elif isident(k):\n            args[k] = v\n\n    argv = sys.argv[:]\n    for arg in sys.argv[:]:\n        orig  = arg\n        value = 'True'\n\n        if '=' in arg:\n            arg, value = arg.split('=', 1)\n\n        if arg in hooks:\n            sys.argv.remove(orig)\n            hooks[arg](value)\n\n        elif free_form and isident(arg):\n            sys.argv.remove(orig)\n            args[arg] = value\n\n    if term_mode:\n        term.init()\n", "path": "pwnlib/args.py"}]}