how to compile libnet for python 2.7 on windows - windows

I have python 2.7 on windows xp, I need libnet but it's not supported for python 2.7 .
I tried to compile it using cygwin, as I don't use python on cygwin gnu and I could not compile it using mingw32, is there any way to install mingw32 in the gnu of cygwin. I read some about VC compile but I totally didn't understand. I need it for w3af framework[which need scapy [which need libnet - and python 2.7]]
trying to make w3af framework run on windows [because it is not supported anymore on win]

You can try this:
Install Python 2.5 and dnet module
https://code.google.com/p/libdnet/downloads/detail?name=dnet-1.12.win32-py2.5.exe&can=2&q=
You can do this on other machine.
Modify filename "dnet-1.12-py2.5.egg-info" to "dnet-1.12-py2.7.egg-info" located at c:\python25\lib\site-packages\
Open binary file of dnet: dnet.pyd located at c:\python25\lib\site-packages\ by Ultraedit or associated tool(I use winhex)
Find the string "python2.5.dll", for my experience, it addressed 0x00019cD1, change hex value from "35" to "37", the string will become "python2.7.dll"
copy that modified file to same place for python2.7 folder (c:\python27\lib\site-packages)
It works on my machine: Windows8, Python2.7.3

I've created a GNU makefile to build it for MSVC. It's here
Tested with Python 2.7 only.

Related

How install multiple version of perl

I have the following question in perl.
1) Is it possible to install multiple version of perl(example perl version: 5.6 and perl version 5.24) in windows system.
2) In case if the above question 1 is possible then how to call the perl file using version. For example, call the new version perl file from old version of perl file.
On Windows systems
You can use berrybrew
To get a list of available versions:
berrybrew available
Based on available versions you can install with following command:
berrybrew install 5.10.1_32
To switch the version:
berrybrew switch 5.10.1_32
On unixy systems
Using perlbrew, you can install different versions of Perl.
You can run a single command against a specific version of Perl using the following command:
perlbrew exec 5.27.11 myscript.pl
You don't need to do anything special. Strawberry Perl is the de-facto standard version of Perl for Windows, and its installer gives you the option of specifying to which directory you want to install it.
For example, I have
...
C:\progs\sp5280-x64 # Perl 5.28, 64-bit
C:\progs\sp5300-x64 # Perl 5.30, 64-bit
C:\progs\sp5302-x64 # Perl 5.32, 64-bit
Simply specify which Perl you want to use when you launch a program.
C:\progs\sp5302-x64\perl\bin\perl a.pl
By editing your PATH and the file association for .pl files, you can set the default perl used from the console and by double-clicking a .pl file.
I suck at Windows administration, but here goes my stupid suggestion anyway.
1)Install different versions of perl in different folders.
2)Include all folders in the %PATH% variable.
3)Rename the perl executables to its version:
perl.exe (5.4) --> perl5_4.exe
perl.exe (5.6) --> perl5_6.exe
4)When using the console to execute it, use
perl5_4 [file]
My honest recommendations are:
Use VirtualBox or any OS virtualization application, which is heavy in hardware requirements but works like wonders.
For any multi-version environment, always use Docker.
Just use Linux and install perlbrew
Simple Way to Do this use Virtual machine
and insall os in VIRTUAL BOX and Install old/new Version in Virtual machine.
Download Virtual BOx

How can I compile Evince3 on Windows using msys2 from Evince3 Source Codes?

Evince3 Source Code link = http://ftp.gnome.org/pub/GNOME/sources/evince/3.26/
I downloaded the Evince3 pdf reader program source code from the above link. and installed msys2 with gcc and gtk3 librares. Evince3 created using gtk3 module in C. but I don't know how to compile source code of Evince3 for using this program on Windows. Is it possible ?
Thanks.
I was curious to learn how to build Gtk apps on windows, so I did it myself, and it took me around one hour.
I followed this guide, https://blogs.gnome.org/nacho/2014/08/01/how-to-build-your-gtk-application-on-windows.
Note that the author used gedit as example. To install evince, you need to download three files from this directory(get 32 or 64 version of install file), https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-evince.
Modify pkgver to 3.26.0 and sha256sum to the hash value in evince-3.26.0.sha256sum in PKGBUILD file, and follow the rest of instructions.
Other way: It's also possible to install pre-built package from mysys2 repo with compiling the source code. Open the msys2 console and give the following command to install Evince.
pacman -S mingw-w64-x86_64-evince

Is there a py2exe version that's compatible with python 3.5?

I am trying to compile my python 3.5 file with the latest py2exe version 0.9.2.2 with the following command:
py -3.5 -m py2exe.build_exe myscript.py
But it reports this:
"run-py3.5-win-amd64.exe" file is not found in the
...lib\site-packages\py2exe\ folder.
Does this mean that py2exe 0.9.2.2 is only compatible up to python 3.4?
Unfortunately as of November 2016 there is still no Python 3.5 support in sight for py2exe. However, I've had great success using cx_Freeze 5.0 with Python 3.5 and since both projects use a very similar configuration I've migrated away from py2exe to cx_Freeze without much work. Binary Wheels of cx_Freeze 5.0 for Python 3.5 are now available officially on PyPi: https://pypi.python.org/pypi/cx_Freeze
Install pyinstaller through Command Prompt (Microsoft Windows) :
search cmd on windows to open Command Prompt with black screen
type and enter: pip install pyinstaller
Again at Command Prompt type and enter: cd c:\....(the Folder where your file example.py is located)
Finally type and enter: pyinstaller --onefile example.py
Now after some minutes your example.exe is ready
There are significant changes in Python 3.5 regarding the MSVCR dll dependency. py2exe 0.9.2.2 supports Python 3.3 and 3.4
Article describing these changes - BUILDING EXTENSIONS FOR PYTHON 3.5
I came here looking for a 3.5 exe generator. I've found that using "pyinstaller" version 3.2 works perfectly with python 35. I found the easiest way to use it is from the command window when on Windows. To make things a little easier you can create a command window from the directory your scripts are stored. Here's how:
From the directory your scripts are saved you can launch a command window by holding 'Alt' + 'Shift' and clicking on the window. In the drop down menu you will see "Open Command Window Here". In that command window you will write 'pyinstaller --onefile script.py' where "script.py" is the name of the script you want to generate the .exe for. I hope this helps someone else as much as it helped me.
Py2Exe just released Py2Exe for Python 3!
To install on windows do this:
cd C:\Python34\Scripts
Then run:
pip install py2exe
And your done you can now run the normal commands, and if your having trouble here are the docs.
I note that the original question was asked just shy of 4 years ago. Visiting https://pypi.org/project/py2exe/
the version offered is still at 0.9.2.2
Using the command pip install py2exe and checking the py2exe directory created on my system, I only see options for Python 3.3 and 3.4 installed.
Given that the last time py2exe was updated was in 2014, my guess is that it is no longer being developed so folks wanting to create executables using versions of Python more recent than 3.4 should look elsewhere for a solution.
**
#I use pyinstaller
#pip install pyinstaller
#command line:
#pyinstaller --onedir --onefile --name=what you call it --console myscript.py
#pyinstaller --onedir --onefile --name=what you call it --windowed myscript.py
#pyinstaller -h help file
#pyinstaller -d -f -n=file name -c or -w myscript.py
**
There is py2exe for python versions that can be downloaded at https://pypi.python.org/pypi/py2exe/0.9.2.0#downloads

Vim for Windows: Python doesn't load properly / “crashes”

I've been struggling for 2 days to install some plugins which use python on Vim (Windows). Even with a stock vimrc.
Using the official vim 7.4 binary (x86)
I've checked that it comes with +python/dyn and +python3/dyn
I've installed Python 2.7.10 x86, and appended python's path in my Path environment.
:echo has('python') prints 1 as expected.
Yet: when I type :python print 'test', vim quits, just as if I've typed :q
:python mum tell me, why does windows exists?, it quits as well. Wondering why... Not a print issue at least.
Using tuxproject's nighty builds of vim 7.4.826 (x86)
It does come with +python/dyn and +python3/dyn. Also:
Used libraries: Perl 5.22.1, Python 2.7.10, Python 3.4.3, Ruby 2.2.3, Lua 5.3.0, Tcl 8.6.4, libXpm.
Great! That's the verison I've downloaded (2.7.10) ! Wait...
:echo has('python') prints 1 as expected.
But, "merry christmas!" says vim.
Sorry, this command is disabled, the Python's site module could not be loaded. Windows isn't good enough. Oh, and merry christmas!
Using tuxproject's nighty builds of vim 7.4.826 (x64)
I tried to use x64's python binary, taking care of removing the x86 version from my Path variable. Same issue as above.
Using Kaoriya's vim 7.4.something (x64) and Veegee's vim 7.4.803
Same issue as above.
What about compiling vim ?
Windows.
I'm not that lazy, well, yes I am... but I'll try to compile it if there isn't any other workaround. I don't really want to compile it if it won't solve anything. If only I could at least understand why these issues happen...
All right, I managed to solve the issue.
For those who may be interested, the intended python version was Python 2.7.9 and not 2.7.10. Installing Python 2.7.9 x86 (and x64) fixed everything for the corresponding vim version.
First of all, need to check for the python version compiled into the vim. One of the way is to edit the gvim executable (e.g. for window it's gvim.exe), and look for "python\d*.dll\c" as mentioned inside the vim manual. Nonetheless, when you run :echo has('python3') || has ('python'), it may give you the hint that vim cannot find and load python27.dll or python32.dll, so you can guess the python get compiled with vim in this way as well.
Once you have identified the python version needed, and if your python is installed on another location, then you can specify the pythonthreedll location to let vim to find it.
:set pythonthreedll=D:\installed\python\python35.dll
check again with following:
:echo has('python3')
I have this problem too but I didn't have to install previous versions.
All I do to solve this is just set PYTHONHOME=C:\Users\MYUSERNAME\Anaconda2 in my system environment variables!
You may have to adjust the location if you did not use Anaconda as a python installer.
Note: I use python 2.7.11 and 3.5 (Both of them are installed via Anaconda 64-bit)
PS. Please ensure that PYTHONHOME is typed correctly, no underscores. And it should point to the location of Python 2 only. Don't point to Python 3 folder.
PPS. It turns out that if you set PYTHONHOME, your working python3 command on the terminal will crash, so I do not suggest this anymore.

How can I setup linux to compile FORTRAN code into windows binaries?

I'm working on a FORTRAN project and I would like to build all of the binaries that I want to maintain on a linux machine that is dedicated for automated builds. I have successfully used mingw to build 32-bit and 64-bit binaries from C source for windows machines on the linux machine with the following packages on Ubuntu.
apt-get install mingw32
apt-get install mingw-w64
Then I run the following commands to actually compile:
gcc -b amd64-mingw32msvc -V 4.4.4 -o <...other options>
However, the mingw packages that I've obtained via apt-get do not include FORTRAN compilers.
Anybody got any ideas on what I can do?
if you got mingw32 and the Gnu C cross compiler is working for you ... when why not just get the Gnu Fortran cross compiler, too?
http://www.nber.org/sys-admin/mingw32-fortran-fedora.html
EXAMPLE apt-get install mingw32-gcc-fortran
I know this is an old thread but a few things seem to have changed and people might still be interested in the topic.
Problem: I want to use my linux machine to compile some code and create a .exe that I can send to people using Windows.
Solution: Essentially here: http ://mxe.cc/
What I did:
Check to see if your system has all the software you need here
run
git clone -b stable https://github.com/mxe/mxe.git
It will download a few small things and create the directory "mxe" (probably in your home folder)
cd into that mxe directory and run "make". HOWEVER: this would take hours and take up a few GB on your hard drive so instead run something like
make mpfr eigen opencsg cgal qt
For more ideas on how to shorten that all see this or the mxe tutorial or somewhere else ;)
The easiest way to compile stuff then seems to be something like:
~/mxe/usr/bin/i686-pc-mingw32-gfortran -c main.f95
~/mxe/usr/bin/i686-pc-mingw32-gfortran main.o -o outfile.exe
Of course you can chose something other than fortran, just consult the mxe/usr/bin to see what its called.
You can always download and install a prebuilt compiler from the MinGW(-w64) project itself:
Windows 64-bit: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/4.6.2-1/
Windows 32-bit: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/4.6.2-1/
Just unpack somewhere and add the cross*/bin directory to PATH.
I include (obj)c(++) and fortran.
On Ubuntu 18.04 I use
apt install gfortran-mingw-w64
Then use the compiler x86_64-w64-mingw32-gfortran in place of gfortran. If you're using cmake, you can configure the compiler from the build directory like so:
FC=x86_64-w64-mingw32-gfortran cmake ..

Resources