How to extract strings from executable file in Python using windows.....when I do it in the django python it give me an error
image
Related
How to automate the download of latest jdk.exe file using shell scripting from oracle and convert to .zip file ?
https://www.oracle.com/java/technologies/downloads/#jdk18-windows
You can directly download the .zip format from the oracle website.
There is no need to convert it from .exe to .zip.
Also, it would be better if you could clarify what shell you need. Considering that youre looking for .exe, im guessing powershell? But who knows...
Im guessing you would just need to copy the download link and have the script grab it from there. For example with bash it would be like below:
#!/bin/bash
curl https://download.oracle.com/java/18/latest/jdk-18_windows-x64_bin.zip -o latest_jdk.zip
download zip file image
I have a .bin file that will comprise of 3 files
1. tar.gz file
2. .zip file
3. install.sh file
For now the install.sh file is empty. I am trying to write a shell script that should be able to extract the .zip file and copy the tar.gz file to a specific location when the *.bin file is executed on an Ubuntu machine. There is a Jenkins job that will pull in these 3 files to create the *.bin file
My Question is how do I access the tar.gz and .zip file from my shell script ?
There are two general tricks that I'm aware of for this sort of thing.
The first is to use a file format that will ignore invalid data and find the correct file contents automatically (I believe zip is one such format/tool).
When this is the case you just run the tool on the packed/concatenated file and let the tool do its job.
For formats and tools where that doesn't work and/or isn't possible the general trick is to embed markers in the concatenated file such that the original script ignores the data but can operate on itself to "extract" the embedded data so the other tool can operate on the extracted contents.
I'm trying to download a large number of files with the extension ".seq.gz" (1907 to be exact), so I'm using 'mget' on my windows command line ftp shell. When trying to unzip the files using WinZip I keep getting this error:
Extracting to "C:\Users\AljanahiA\AppData\Local\Temp\wz1a02\"
Use Path: yes Overlay Files: yes
Extracting gbvrt7.seq
Severe Error: CRC of extracted file does not match stored value.
Of course the same thing happens when I use 'get' and download a single file. BUT, when I manually download the files from the ftp webpage, it unzips perfectly fine.
Thoughts?
I am doing some data mapping from an .xls excel document, and I am trying to write a quick script to pull images out excel document.
What is the quickest, simplest way to do this programatically?
I am running Ubuntu 10.10 and I would prefer to user python if possible.
a XLSX file is a compressed file.
$ unzip file.xlsx
in xl/media/ are all pictures. This is not true for older .XLS files, but you can convert them to XLSX with a modern version of MS Office.
If you don't have MS Office, you can do the same thing with LibreOffice. Convert the file to .ods and then open it as a zip file and it will be in the Pictures folder.
I hate to answer my own question, but the best method I found only required two commands at the command line (assuming you have the right software installed).
First, use unoconv to convert the .xls to .pdf:
http://dag.wieers.com/home-made/unoconv/
On Ubuntu 10.10 command line:
sudo apt-get install unoconv
unoconv -f pdf file.xls
Then extract the images from the pdf using pdfimages (which seems to come bundled with Ubuntu):
http://en.wikipedia.org/wiki/Pdfimages
Back on the command line:
pdfimages file.pdf fileimage
And done! All of the images in the .xls are now in separate files in the directory. This could be done very easily on most Linux systems using your language of choice. In python, for example:
import subprocess
subprocess.call(['unoconv','-f','pdf','file.xls'])
subprocess.call(['pdfimages','file.pdf','fileimage'])
I would love to hear a simpler solution if somebody has one.
How do I extract all the dependencies from a Windows file in Python? So I basically want to extract all the used exe,dll,osx,sys etc. files.
I would like to to this in Python or directly with grep.
Pefile can help you parse PE executables. You can find some usage examples on the project's page.