samedi 21 décembre 2013

create usb boot

aptitude install mbr dosfstools mtools syslinux-common




# Pour la version 64 bits
wget http://ftp.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/hd-media/boot.img.gz
# Pour la version 32 bits
wget http://ftp.debian.org/debian/dists/wheezy/main/installer-i386/current/images/hd-media/boot.img.gz

Décompresser là :

gunzip boot.img.gz

Insérer la clé USB destinataire :

veiller à ce qu'elle ne se monte pas automatiquement et la démonter au besoin
repérer le périphérique, par exemple /dev/sdb

Copier bit à bit le bootstrap sur la clé :

dd if=boot.img of=/dev/sdb bs=512

Récupérer la signature MD5 de la clé et du bootstrap pour vérifier :

md5sum /dev/sdb
md5sum boot.img

Monter la clé :

mkdir /tmp/USB
sudo mount /dev/sdb /tmp/USB

Récupérer l'image NetInst en amd64 ou en i386de la Debian

# pour architecture 64 bits
wget http://cdimage.debian.org/debian-cd/7.1.0/amd64/iso-cd/debian-7.1.0-amd64-netinst.iso
# pour architecture 32 bits
wget http://cdimage.debian.org/debian-cd/7.1.0/i386/iso-cd/debian-7.1.0-i386-netinst.iso

La copier sur la clé :

# pour architecture 64 bits
sudo cp debian-7.1.0-amd64-netinst.iso /tmp/USB
# pour architecture 32 bits
sudo cp debian-7.1.0-i386-netinst.iso /tmp/USB

Installer les pilotes non libres BNX2 et BNX2X :

sudo apt-get install firmware-bnx2x firmware-bnx2

Copier les pilotes sur la clé USB :

sudo cp /lib/firmware/bnx* /tmp/USB

Démonter la clé : tout est prêt pour l'installation :

sudo umount /tmp/USB


sinon voir l'excellent outil easy2boot (fin de la prise de tête :-)) tuto sur http://www.lecadelo.fr/easy2boot-une-trousse-a-outils-de-poche/

jeudi 10 octobre 2013

Excel 2003 VBA Project lost password

There is another (somewhat easier) solution, without the size problems. I used this approach today (on a 2003 XLS file, using Excel 2007) and was successful.

Backup the xls file
Using a HEX editor, locate the DPB=... part
Change the DPB=... string to DPx=...
Open the xls file in Excel
Open the VBA editor (ALT+F11)
the magic: Excel discovers an invalid key (DPx) and asks whether you want to continue loading the project (basically ignoring the protection)
You will be able to overwrite the password, so change it to something you can remember
Save the xls file*
Close and reopen the document and work your VBA magic!

*NOTE: Be sure that you have changed the password to a new value, otherwise the next time you open the spreadsheet Excel will report errors (Unexpected Error), then when you access the list of VBA modules you will now see the names of the source modules but receive another error when trying to open forms/code/etc. To remedy this, go back to the VBA Project Properties and set the password to a new value. Save and re-open the Excel document and you should be good to go!


source : http://stackoverflow.com/questions/1026483/is-there-a-way-to-crack-the-password-on-an-excel-vba-project

vendredi 20 septembre 2013

X11 Forwarding Fails When IPv6 is Disabled [Resolved]

So, I put the following lines in remote host’s /etc/ssh/sshd_config file.

$ cat /etc/ssh/sshd_config

………………………………

# Workaround to have X forwarding work when ipv6 is disabled
# http://ubuntuforums.org/showthread.php?t=1649657
AddressFamily inet

dimanche 15 septembre 2013

howto fix default storage pool location for virt-manager (and libvirt)

/usr/bin/virt-manager

pool-destroy default
pool-undefine default
pool-define-as --name default --type dir --target /storage/local/images
pool-autostart default
pool-build default
pool-start default
pool-destroy local
pool-undefine local
pool-define-as --name local-iso --type dir --target /storage/local/iso
pool-autostart local-iso
pool-build local-iso
pool-start local-iso
quit

Cygwin: bash Here

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command]
@="c:\\cygwin\\bin\\bash.exe --login -i -c \"cd \\\"`cygpath -u '%V'`\\\";bash\""

[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@="c:\\cygwin\\bin\\bash.exe --login -i -c \"cd \\\"`cygpath -u '%V'`\\\";bash\""

For those of you who like regedit, here’s the same thing unescaped:

HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command
c:\cygwin\bin\bash.exe --login -i -c "cd \"`cygpath -u '%V'`\";bash"

HKEY_CLASSES_ROOT\Directory\shell\cmd\command
c:\cygwin\bin\bash.exe --login -i -c "cd \"`cygpath -u '%V'`\";bash"

mardi 27 août 2013

cntlm : windows tools for ssh tunneling over proxy http with putty

#---see http://cntlm.sourceforge.net/

echo cntlm -v -f -s -c "C:\Program Files (x86)\Cntlm\cntlm.ini"
cntlm -v -f -s -c "C:\Program Files (x86)\Cntlm\cntlm.ini"

Generate HashPassword

cntlm -v -u username -d domainename -H

cntlm.ini

Username username
PassNTLMv2 08192805CB06C3214581268F86EEA8
Domain domainename

Proxy proxyname

NoProxy localhost, 127.0.0.*, 10.*, 192.168.*, 172.24.*

Listen 9999

Header User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)

...and use putty --> proxy on 9999



Start FireFox script for FoxyProxy

#cygwin bash ------------------------------------------------------------------------------------------
#!/bin/bash

# xmlstarlet sel -t -m "//foxyproxy/proxies" -m "proxy" -v "@name" -o ":" -v "@id" -n /cygdrive/c/Users/`whoami`/appdata/Roaming/Mozilla/Firefox/profiles/*.default/foxyproxy.xml

SleepTime=5
File="/cygdrive/c/Users/`whoami`/appdata/Roaming/Mozilla/Firefox/profiles/7c1tsms2.default/foxyproxy.xml"
FireFox=/cygdrive/c/Program\ Files\ \(x86\)/Mozilla\ Firefox/firefox.exe

IPWork=10
LocalisationIP=$(ipconfig | grep -i ipv4 | cut -f2 -d':' | cut -f1 -d'.' )

if [ $LocalisationIP -eq $IPWork ]; then
WorkName="Work"
echo Lan Work : $LocalisationIP
else
WorkName="Default"
echo Lan Home : $LocalisationIP
fi

# echo "/usr/bin/xmlstarlet sel -t -m "foxyproxy/proxies/proxy[@name=$WorkName]" -v "@id" -n $File"
ProxyID=$(/usr/bin/xmlstarlet sel -t -m "foxyproxy/proxies/proxy[@name='$WorkName']" -v "@id" -n $File)

cd /cygdrive/c/Program\ Files\ \(x86\)/Mozilla\ Firefox/
echo "cmd /c start 'FireFox' -foxyproxy-mode $ProxyID"
cmd /c start "FireFox" -foxyproxy-mode $ProxyID

while [ -z "${Pid}" ]; do
Pid=$(pslist |grep -i firefox | awk '{print $2}')
echo Firefox starting...
sleep $SleepTime
done

exit


#Dos---------------------------------------------------------------------------------------------------
@cls
@echo off
@Set RsxWork=172

for /f "delims= " ^%%i in ('ipconfig ^| grep -i ipv4 ^| cut -f2 -d':' ^| cut -f1 -d'.' ') do set myip=^%%i

@echo %myip% %RsxWork%

IF "%myip%"=="%RsxWork%" (
@echo Work Network....
start "Firefox" "c:\Program Files (x86)\Mozilla Firefox\firefox.exe" -foxyproxy-mode 1971257625
)

IF NOT "%myip%"=="%RsxWork%" (
@echo Home Network....
start "Firefox" "c:\Program Files (x86)\Mozilla Firefox\firefox.exe" -foxyproxy-mode 2153982398
)

@echo is starting...

Associate .sh bash cygwin

assoc .sh=bashscript

ftype bashscript=D:\cygwin.64\bin\bash.exe --login -i -c 'cd "$(dirname "$(cygpath -u "%1")")"; bash "$(cygpath -u "%1")"'

ftype bashscript=D:\cygwin.64\bin\bash.exe "%1"

samedi 6 juillet 2013

raspberry usb read files


aptitude install usbmount



#!/bin/bash 

mroot=/media/usb*

#loop infini
while [ 1 -eq 1 ]
  do
  
   # loop sur les fichiers trouvés sur les montages USB
    for file in `find $mroot -type f  | sort -n`  
     do
       echo "file = $file";
       omxplayer $file
     done

done

vendredi 28 juin 2013

Enabling SyntaxHighlighter in Blogger Step-by-Step

Voir sur

ubuntu


# desinstaller unity

aptitude remove –purge remove unity unity-2d unity-2d-common  unity-2d-panel unity-2d-shell unity-2d-spread unity-asset-pool  unity-common unity-lens-applications unity-lens-files unity-lens-music  unity-lens-video unity-scope-musicstores unity-scope-video-remote  unity-services indicator-messages indicator-status-provider-mc5  appmenu-qt appmenu-gtk appmenu-gtk3 lightdm unity-greeter  overlay-scrollbar zeitgeist zeitgeist-core zeitgeist-datahub  activity-log-manager-common activity-log-manager-control-center

#supprimer ascenceurs

sudo echo « export LIBOVERLAY_SCROLLBAR=0″ > /etc/X11/Xsession.d/80overlayscrollbars

aptitude remove –purge overlay-scrollbar liboverlay-scrollbar-0.1-0

# installer gnome http://doc.ubuntu-fr.org/gnome-session-fallback

autofs5 peace-gdm-theme sabily-gdm-themes tropic-gdm-theme  ubuntume-gdm-themes mythbuntu-gdm-theme gdm-theme gdm geany  geany-plugin-addons geany-plugin-codenav geany-plugin-debugger  geany-plugin-doc geany-plugin-gendoc geany-plugin-gproject  geany-plugin-insertnum geany-plugin-latex geany-plugin-lipsum  geany-plugin-lua geany-plugin-macro geany-plugin-numberedbookmarks  geany-plugin-pg geany-plugin-prettyprinter geany-plugin-prj  geany-plugin-sendmail geany-plugin-shiftcolumn geany-plugin-spellcheck  geany-plugin-tableconvert geany-plugin-treebrowser  geany-plugin-updatechecker geany-plugin-vc geany-plugin-webhelper  geany-plugin-xmlsnippets geany-plugins geany-plugins-common

aptitude install gnome-session-fallback thunderbird  thunderbird-globalmenu thunderbird-gnome-support thunderbird-locale-en  thunderbird-locale-en-us thunderbird-locale-fr chromium-browser compiz  compiz-core compiz-gnome compiz-plugins compiz-plugins-default  compiz-plugins-extra compiz-plugins-main compiz-plugins-main-default  compizconfig-backend-gconf rhythmbox-mozilla totem-mozilla firefox  firefox-globalmenu firefox-gnome-support firefox-locale-en  firefox-locale-fr compiz-gnome firefox-gnome-support  gir1.2-gnomebluetooth-1.0 gnome-accessibility-themes gnome-bluetooth  gnome-control-center gnome-control-center-data gnome-desktop3-data  gnome-disk-utility gnome-font-viewer gnome-games-data gnome-icon-theme  gnome-icon-theme-symbolic gnome-keyring gnome-media gnome-menus  gnome-nettool gnome-online-accounts gnome-orca gnome-power-manager  gnome-screensaver gnome-screenshot gnome-session gnome-session-bin  gnome-session-canberra gnome-session-common gnome-settings-daemon  gnome-shell gnome-sudoku gnome-system-log gnome-system-monitor  gnome-terminal gnome-terminal-data gnome-user-guide gnome-user-share  language-pack-gnome-en language-pack-gnome-en-base  language-pack-gnome-fr language-selector-gnome network-manager-gnome  network-manager-pptp-gnome policykit-1-gnome ssh-askpass-gnome  system-config-printer-gnome thunderbird-gnome-support  ubuntuone-client-gnome terminator evince evince-common vlc vlc-data  vlc-nox vlc-plugin-notify vlc-plugin-pulse python-simplejson simple-scan  shotwell eog libreoffice-base-core libreoffice-calc libreoffice-common  libreoffice-core libreoffice-draw libreoffice-emailmerge  libreoffice-gnome libreoffice-gtk libreoffice-help-en-us  libreoffice-help-fr libreoffice-impress libreoffice-math  libreoffice-style-human libreoffice-style-tango libreoffice-writer

Mint

# Mint

#removing mate


aptitude remove –purge atril atril-common caja caja-common engrampa  engrampa-common ffmpegthumbnailer-caja libcaja-extension libmarco  libmate libmate-common libmatecanvas libmatecomponent libmatecomponentui  libmateconf libmatecorba libmatedesktop libmatekbd libmatekeyring  libmatemenu libmatenotify libmatepanelapplet libmatepolkit libmateui  libmatevfs libmateweather libmateweather-common marco marco-common  mate-applets mate-applets-common mate-backgrounds mate-conf  mate-conf-common mate-control-center mate-corba mate-core mate-desktop  mate-desktop-common mate-dialogs mate-icon-theme mate-keyring mate-media  mate-menus mate-mime-data mate-panel mate-panel-common mate-polkit  mate-power-manager mate-power-manager-common mate-screensaver  mate-session-manager mate-settings-daemon mate-settings-daemon-common  mate-settings-daemon-gstreamer mate-system-monitor mate-terminal  mate-terminal-common mate-text-editor mate-themes mate-vfs  mate-vfs-common mate-window-manager python-mate

aptitude remove –purge libmatesensorsappletplugin mate-calc  mate-desktop-environment mate-netspeed mate-sensors-applet  mate-system-tools mate-utils mozo python-mate-menu system-tools-backends

dpkg -l | awk ‘/^rc/ {print $1″ « $2}’

samedi 22 juin 2013

nmap

nmap -sP 192.168.1.0/24

cdrw


aptitude install -y wodim

wodim --devices
wodim -v dev=/dev/sr0 -blank=fast

wodim -tao dev=/dev/sr0 -v -data /my/directory/image.iso

xen

#!/bin/sh
clear

vmname=debian-stable
vmpath=/mnt/d200Go/xen/domains
root=$vmpath/$vmname/$vmname.img
swap=$vmpath/$vmname/$vmname.swap.img
arch=i386
version=wheezy

if [ -d $vmpath/$vmname/$vmname ] ; then
 echo rm -rf $vmpath/$vmname/$vmname
 rm -rf $vmpath/$vmname/$vmname 
fi

echo .
echo mkdir -p $vmpath/$vmname/$vmname
mkdir -p $vmpath/$vmname/$vmname

# Disk / 4Go
echo .
echo dd if=/dev/zero of=$root bs=1M count=4000
dd if=/dev/zero of=$root bs=1M count=4000

# swap 512Mo
echo .
echo dd if=/dev/zero of=$swap bs=1M count=512
dd if=/dev/zero of=$swap bs=1M count=512

echo .
echo mkfs.ext4 -F $root; mkswap $swap
mkfs.ext4 -F $root; mkswap $swap

echo .
echo mkdir -p /tmp/xen/$vmname
mkdir -p /tmp/xen/$vmname

echo .
echo mount -t ext4 -o loop $root /tmp/xen/$vmname
mount -t ext4 -o loop $root /tmp/xen/$vmname

echo .
echo debootstrap --arch $arch $version /tmp/xen/$vmname $mirror
debootstrap --arch $arch $version /tmp/xen/$vmname $mirror

echo .
echo xen-create-image --verbose --dir=$vmpath --size=2Gb --swap=128Mb --memory=128Mb --fs=ext4 --dhcp --pygrub --passwd --dist=$version --force --hostname=$vmname
xen-create-image --verbose --dir=$vmpath --size=2Gb --swap=128Mb --memory=128Mb --fs=ext4 --dhcp --pygrub --passwd --dist=$version --force --hostname=$vmname

# modifs xen-tools.conf (dhcp, lvm, etc...)

# copy img to lvm
dd if=/home/xen/domains/xen1.example.com/disk.img of=/dev/vg0/xen1_root
dd if=/home/xen/domains/xen1.example.com/swap.img of=/dev/vg0/xen1_swap

--> change .cfg

... and change...

[...]

disk        = [
'file:/home/xen/domains/xen1.example.com/swap.img,xvda1,w',
'file:/home/xen/domains/xen1.example.com/disk.img,xvda2,w',
]

[...]

... to ...

[...]

disk        = [
'phy:/dev/vg0/xen1_swap,xvda1,w',
'phy:/dev/vg0/xen1_root,xvda2,w',
]

[...]

lvm to img

dd if=/dev/VolGroup00/migrationtesting_rootimg of=/root/migrationtesting.img bs=4096 conv=noerror

Method 2

Create a 10 gig image file, Change this according to how much space customer is using (IE a little more then what is being used)

dd if=/dev/zero of=/root/migrationtesting.img bs=1M count=1 seek=10240

#format it
mkfs.ext3 migrationtesting.img

#Mount it
mkdir /root/migratingtesting
mount -o loop migratingtesting.img migratingtesting

#Copy the mounted files over from hyperVM and unmount afterward
cp -rp /home/xen/migrationtesting.vm/mnt/* /root/migratingtesting
umount /root/migratingtesting

#xen
aptitude install xen-hypervisor-4.1 xen-linux-system xen-utils xen-tools bridge-utils

dpkg-divert --divert /etc/grub.d/08_linux_xen --rename /etc/grub.d/20_linux_xen
#undo
dpkg-divert --rename --remove /etc/grub.d/20_linux_xen

Nux intall


apt-get install -y aptitude
aptitude install -y screen htop gpm sysv-rc-conf openssh-server mc rsync ntpdate gdebi less bash-completion bash-builtins bzip2
aptitude install -y unzip unrar unrar-free p7zip p7zip-full p7zip-rar  nfs-common traceroute acl nmap ethtool dnsutils wodim eject
aptitude install -y libdate-manip-perl libfile-find-rule-perl

adddptkey.sh D834D91FA49CCDDB ; adddptkey.sh 6AF0E1940624A220; adddptkey.sh D834D91FA49CCDDB; adddptkey.sh 6AF0E1940624A220

aptitude install gdm gnome-shell synaptic deborphan ubuntu-tweak
  
# aptitude search geany |grep ^i|grep -v lib| sed « s/i A /i /g »|awk ‘{print $2″ « }’ | tr -d ‘\n’

#xfce
aptitude install -y xserver-xorg xfonts-base xfce4 gedit gnome-terminal  gnome-terminal-data nautilus gdebi gdebi-core gparted file-roller  gnome-core

# debian gnome
aptitude install x-window-system-core gnome-core gdm gedit  gnome-terminal gnome-terminal-data nautilus gdebi gdebi-core gparted  file-roller

# debian sans gnome / gdm
update-rc.d gdm3 remove

# Debian pulseaudio
aptitude install pulseaudio libao4 paprefs libpulse-mainloop-glib0  pulseaudio-module-jack pavucontrol pulseaudio-module-hal  pulseaudio-module-x11 gstreamer0.10-pulseaudio pulseaudio-utils  libasound2-plugins paman pulseaudio-module-gconf libgconfmm-2.6-1c2  libpulse-browse0 pavumeter libglademm-2.4-1c2a pulseaudio-esound-compat  libpulse0 libpulse-dev pulseaudio-module-bluetooth  pulseaudio-module-zeroconf

# installer de quoi compiler
aptitude install -y linux-headers-`uname -r` gcc build-essential

#vlc
vlc vlc-nox libavcodec-extra-52

#broadcomm
modprobe -r b44 b43 b43legacy ssb brcmsmac

# supprimer les firmware des cartes wifi inutiles ==> aptitude search firmware | grep ^i
aptitude install linux-headers-$(uname -r|sed ‘s,[^-]*-[^-]*-,,’) broadcom-sta-dkms
modprobe wl ; iwconfig

# la carte doit être visible dans le networkmanager !
#Supprimer beep http://forums.linuxmint.com/viewtopic.php?f=49&t=75825
#

#————————————————————————–
echo ‘APT::Get::Purge « true »;’ >/etc/apt/apt.conf
cat /etc/apt/apt.conf

#—————————————————————————
# /etc/inputrc http://tiswww.case.edu/php/chet/readline/readline.html
# DJR le 10/01/08 naviguer dans l’historique des commandes
« \e[A": history-search-backward
"\e[B": history-search-forward
# CTRL + fleche gauche et droite
"\eOC": forward-word
"\eOD": backward-word
"\e\eOC": forward-word
"\e\eOD": backward-word
set completion-ignore-case On
set show-all-if-ambiguous On
set bell-style none

#---------------------------------------------------------------------------
# bashrc
# DJR ADD
# Comment in the above and uncomment this below for a color prompt
PS1='\[\033[1;33m\]\u\[\033[1;37m\]@\[\033[1;32m\]\h\[\033[1;37m\]:\[\033[1;31m\]\w \[\033[1;36m\]\n\$ \[\033[0m\]‘
# If this is an xterm set the title to user@host:dir
case « $TERM » in
xterm*|rxvt*)
PROMPT_COMMAND=’echo -ne « \033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007″ ‘
;;
*)
;;
esac
# You may uncomment the following lines if you want `ls’ to be colorized:
export LS_OPTIONS=’–color=auto’
eval « `dircolors` »
# some more ls aliases
alias md=’mkdir –p’
alias lsa=’ls -lahF –color=auto’
alias psa=’ps -aux –sort -rss’
alias l=’ls -CFh –color=auto’
# enable programmable completion features (you don’t need to enable
# this, if it’s already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
PATH=$PATH:/opt/sadar/bin
export PATH
http_proxy=`sed -e ‘s/Acquire::http::Proxy \ »http:\/\///g’ /etc/apt/apt.conf|sed ‘s/\ »;//g’`
if [ "$http_proxy" != "" ]; then
export http_proxy;
else
unset http_proxy;
fi
shopt -s cdspell
shopt -s histappend
#DJR bip
setterm -blength 0
#Bash History
#export HISTCONTROL=ignoreboth
export HISTCONTROL=ignoreboth
export HISTSIZE=5000
export HISTFILESIZE=200000
shopt -s histappend
export PROMPT_COMMAND= »history -a; history -n; history -r; $PROMPT_COMMAND »
# supporte des terminaux redimensionnables (xterm et screen -r)
shopt -s checkwinsize
# Pour permettre de taper des caractères accentués dans le shell :
bind ‘set convert-meta off’

#—————————————————————————
# profile
# DJR ADD
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
# set PATH so it includes user’s private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:/opt/sadar/bin: »${PATH} »
fi
#export LANGUAGE= »fr »
#export LANG= »fr_FR.utf8″
export LANGUAGE= »en_US:en »
export LANG= »en_US.UTF-8″

#—————————————————————————
# Console en mode 1024×768
#
aptitude -y install v86d
sh -c « echo uvesafb >> /etc/initramfs-tools/modules »
modprobe uvesafb
cat /sys/bus/platform/drivers/uvesafb/uvesafb.0/vbe_modes
sh -c « echo options uvesafb mode_option=1024×768-32 scroll=ywrap > /etc/modprobe.d/uvesafb.conf »
update-initramfs -k all -u

#—————————————————————————
#squeeze wheezy
echo net.ipv6.conf.all.disable_ipv6=1 > /etc/sysctl.d/disableipv6.conf
GRUB_CMDLINE_LINUX= »ipv6.disable=1″
#ubuntu
GRUB_CMDLINE_LINUX= »disable_ipv6=1″
#—————————————————————————
#

adduser xxc