REM Method 1
~ # tune2fs -c 1 /dev/name_of_device
REM Method 2
~ # touch /forcefsck
Sunday, December 28, 2014
Run fsck on a partition during the next boot
These are said to work for Ubuntu, I imagine the tune2fs one at least will work in Arch but have not yet tried.
Monday, November 3, 2014
Re-creating launchers for wine applications
If you can find the .lnk launchers created within the wine virtual drive, then you can create the linux launcher items with wine's menubuilder.
$ locate <program name>.lnk
... ( bunch of junk here ) ...
$ wine winemenubuilder <shortcut.lnk>
Thursday, October 23, 2014
TCP and UDP traceroute options
I found this blog entry that details how to use the regular Linux traceroute command for UDP or TCP tracerouting.
ICMP (the default, so -I not needed)
UDP
TCP
ICMP (the default, so -I not needed)
$ traceroute -I www.microsoft.com
UDP
# traceroute -U www.microsoft.com
TCP
# traceroute -T -p 80 www.microsoft.com
Saturday, October 18, 2014
Find files owned or not owned by a user
Find all files owned by joe.baloney
$ find . -user joe.baloney -print
Find files NOT owned by joe
find . \! -user tward -print
Wednesday, October 8, 2014
Getting detailed device information with udevadm
The following command outputs info about the device specified as well as any other devices in the chain (e.g. USB controllers etc...)
udevadm info --attribute-walk --name=/dev/sda
Wednesday, September 17, 2014
VFAT is patented??
I just found that the VFAT "file system" has a patent. Is there anything Microsoft can't do? It makes we wonder that they haven't they patented using consecutive memory address locations for arrays.
The surprising thing is that all of the articles I seem to come across discussing this, none of them include reactions such as WTF???
First of all it sucks, and its only in use now because its already in use now.
http://www.linux-mag.com/id/7325/
The surprising thing is that all of the articles I seem to come across discussing this, none of them include reactions such as WTF???
First of all it sucks, and its only in use now because its already in use now.
http://www.linux-mag.com/id/7325/
Friday, September 12, 2014
Scapy's send vs sendp
From secdev.org I found the difference in Scapy's various send methods.
In scapy, the send() function will send packets at layer 3. That is to say it will handle routing and layer 2 for you.
The sendp() function will work at layer 2. It's up to you to choose the right interface and the right link layer protocol.
More information:
In scapy, the send() function will send packets at layer 3. That is to say it will handle routing and layer 2 for you.
>>> send(IP(dst="1.2.3.4")/ICMP())
The sendp() function will work at layer 2. It's up to you to choose the right interface and the right link layer protocol.
>>> sendp(Ether()/IP(dst="1.2.3.4",ttl=(1,4)), iface="eth1")
More information:
>>> lsc()
sr : Send and receive packets at layer 3
sr1 : Send packets at layer 3 and return only the first answer
srp : Send and receive packets at layer 2
srp1 : Send and receive packets at layer 2 and return only the first answer
srloop : Send a packet at layer 3 in loop and print the answer each time
srploop : Send a packet at layer 2 in loop and print the answer each time
sniff : Sniff packets
p0f : Passive OS fingerprinting: which OS emitted this TCP SYN ?
arpcachepoison : Poison target's cache with (your MAC,victim's IP) couple
send : Send packets at layer 3
sendp : Send packets at layer 2
traceroute : Instant TCP traceroute
arping : Send ARP who-has requests to determine which hosts are up
ls : List available layers, or infos on a given layer
lsc : List user commands
queso : Queso OS fingerprinting
nmap_fp : nmap fingerprinting
report_ports : portscan a target and output a LaTeX table
dyndns_add : Send a DNS add message to a nameserver for "name" to have a new "rdata"
dyndns_del : Send a DNS delete message to a nameserver for "name"
TCPDump Primer
I can never remember all the options for tcpdump, the always impressive blog from Daniel Miessler has this excellent primer.
For example, -s is the "snaplength" which determines the number of bytes per packet to capture. By default tcpdump only gets like 96 bytes. Using -s0 will cause it to capture all packets and -X will output hex and ASCII.
For example, -s is the "snaplength" which determines the number of bytes per packet to capture. By default tcpdump only gets like 96 bytes. Using -s0 will cause it to capture all packets and -X will output hex and ASCII.
# tcpdump -s0 -X
Tuesday, September 9, 2014
Mindblowingly insecure SuperMicro remote management interface
This is somewhat mind boggling to me, maybe its because I'm not a professional system adminstrator, but I had no idea that this existed. I maintain a proxmox VM server running on a SuperMicro server mostly for my own use.
I asked for the offending IP, and was given an external (public) IP. Now I had turned my SuperMicro off, but when I entered the given IP I was greeted with a SuperMicro login page. I noticed my server's network lights were blinking...
It turns out that SuperMicro comes with something called IPMI or Intelligent Platform Management Interface that has the following properties:
I disabled this temporarily by setting a static IP/gateway using invalid values.
What happened
Our IT department told me a machine in my area was participating in a DDOS and gave me the MAC address. I couldn't find the MAC anywhere on my internal network but the manufacturer was SuperMicro.I asked for the offending IP, and was given an external (public) IP. Now I had turned my SuperMicro off, but when I entered the given IP I was greeted with a SuperMicro login page. I noticed my server's network lights were blinking...
It turns out that SuperMicro comes with something called IPMI or Intelligent Platform Management Interface that has the following properties:
- On by default.
- Obtains dynamic IP by default.
- Default username/password is DEFAULT/DEFAULT
- The IP/Mac address is not visible to the booted operating system, at least not with netstat etc...
- No option to disable.
- Plaintext Supermicro IPMI Credentials Exposed
- Despite patches, Supermicro's IPMI firmware is far from secure, researchers say
- Supermicro IPMI/BMC Vulnerability Analysis
- At least 32,000 servers broadcast admin passwords in the clear, advisory warns
- Supermicro IPMI Firmware Vulnerabilities
I disabled this temporarily by setting a static IP/gateway using invalid values.
Thursday, September 4, 2014
The only proper way to vote in the USA
There is only one proper way to vote in the US if you want any non-weasel to get into office: Vote for anyone you have never heard of.
If you have heard of them, they have connections and/or money and want something out of the job. If people do it enough all the ridiculous campaign contributions / TV and social media ads in the world won't matter.
Sure, a wacko may get elected here and there, but a wacko would do far less damage than a political cronie with an agenda. This is how I've voted for years, and it means nothing until it gets adopted by the masses.
If you have heard of them, they have connections and/or money and want something out of the job. If people do it enough all the ridiculous campaign contributions / TV and social media ads in the world won't matter.
Sure, a wacko may get elected here and there, but a wacko would do far less damage than a political cronie with an agenda. This is how I've voted for years, and it means nothing until it gets adopted by the masses.
How to print to an active directory printer
I don't really know how to get this to work exactly, but what I do know is that after an ungodly amount of screwing around with cups, samba and kerberos to no avail, I finally deleted the printer and re-added it and VOILA!
Before I would not get prompted for authentication (in most programs, but some WOULD), and when re-adding the printer I was allowed to enter the auth information.
Before I would not get prompted for authentication (in most programs, but some WOULD), and when re-adding the printer I was allowed to enter the auth information.
Wednesday, September 3, 2014
Finding failed services with systemctl
Just found a very handy command:
Outputs services that failed to load.
# systemctl -t service --failed
Outputs services that failed to load.
KDE Printer Configuration and the Authentication Dialog
When managing printers via KDEs print settings, any change requires a root enabled password. However the dialog that asks for it is unable to be focused and sits in the background until you cancel it. The amazing thing is I have had this issue for YEARS and it has yet to be fixed. MANY TIMES have I tried to find the problem with no luck, unsure of exactly which search terms to use.
I finallyfound a bug report that addresses this, starting in 2012 (its now the 9th month of 2014).
Basically, the workaround is to run:
to start the printer config as root, which in itself is not an easy thing to figure out. Which is why I am documenting it here.
I finally
Basically, the workaround is to run:
$ kdesu kcmshell4 kcm_printer_manager
to start the printer config as root, which in itself is not an easy thing to figure out. Which is why I am documenting it here.
Wednesday, August 20, 2014
Proxmox updates and "no valid subscription" message
I just realized my ProxMox server hasn't been getting updates for many months now, and the same post pointed me to a simple way to remove the nagging "You have no valid subscription message" you get from logging in.
This post says that at some point I was supposed to change my repositories, but when I began getting the indicated "error" message, my searches indicated it was harmless so I ignored it.
And then this one shows how to remove the nag message.
This post says that at some point I was supposed to change my repositories, but when I began getting the indicated "error" message, my searches indicated it was harmless so I ignored it.
And then this one shows how to remove the nag message.
Netcat snippets
A host of useful netcat commands can be found at some guys blog
What I was actually looking for was a way to forward a port from 80 to 22 on a local machine, this can be done according to Jonas Wagner's blog with:
Although on my gnu netcat, -c needs to be -e:
What I was actually looking for was a way to forward a port from 80 to 22 on a local machine, this can be done according to Jonas Wagner's blog with:
nc -l -p 80 -c "sudo nc localhost 22"
Although on my gnu netcat, -c needs to be -e:
nc -l -p 80 -e "sudo nc localhost 22"
Thursday, August 14, 2014
Upload ssh certificates with ssh-copy-id
I've been doing this manually for years, and just found there is a command specifically made to add login certificate to an ssh server to allow remote login without password authentication.
ssh-copy-id -i id_rsa -p 22 $user@$host
Tuesday, August 12, 2014
Disable line wrapping in terminal
I just found this very useful at times option:
The command setterm -linewrap off will prevent lines from wrapping and messing up the beginning of the next line.
Also is using screen then Ctrl-A Ctrl-R will toggle line wrap.
The command setterm -linewrap off will prevent lines from wrapping and messing up the beginning of the next line.
Also is using screen then Ctrl-A Ctrl-R will toggle line wrap.
Tuesday, August 5, 2014
Boot Dell Venue 11 Pro from USB
This has been frankly incredible. I have been trying for days to get a Dell Venue to boot from USB, or at least destroy the existing Win 8.0 partition. I have tried SO many different things, and every single one has failed for one reason or another.
- Upgrade to 8.1 will not work, because I have to "turn off bitlocker" which is not on or installed (since it tells me to reboot with my install disk in order to turn it on) and has no option other than "turn on".
- I have been unable to boot from USB due to "invalid partition".
- I got some sort of Win8.1 boot thing happening only to be told I was "Missing a media driver" which apparently was none of the Dell drivers I downloaded using the service tag.
- I finally got an Ubuntu formatted USB stick to boot by going into bios, and enabling Legacy Roms, but NOT enabling legacy boot, then adding a new boot option to the uefi boot menu that was one of the random looking strings that had the word USB in it... HOORAY UBUNTU BOOTED!
- BOOOO the display will display nothing but blackness despite the fact that it has clearly booted since I can hear volume up/down noises when pressing volume buttons.
Friday, July 25, 2014
Arch Linux Kernel Configuration
I have read several posts alluding to a kernel configuration file in /boot/config-, but I don't have that file.
According to http://wiki.linuxaudio.org/wiki/system_configuration I tried the following which produced a kernel configuration file:
According to http://wiki.linuxaudio.org/wiki/system_configuration I tried the following which produced a kernel configuration file:
$ cat /proc/config.gz | gunzip > /home/tward/Desktop/config-`uname -r`
Thursday, July 10, 2014
Mysterious missing bluetooth device
I've had this happen before, KDE swears I have no bluetooth device, despite no errors in journal or dmesg.
Even lsusb shows no bluetooth device.
Install "rfkill" and run
# rfkill list
...
1: dell-bluetooth: Bluetooth
Soft blocked: yes
Hard blocked: no
then
# rfkill unblock bluetooth
and everything works again.
Even lsusb shows no bluetooth device.
Install "rfkill" and run
# rfkill list
...
1: dell-bluetooth: Bluetooth
Soft blocked: yes
Hard blocked: no
then
# rfkill unblock bluetooth
and everything works again.
Wednesday, July 9, 2014
Simplifying python2 vs python3 problems
In Arch Linux, python3 is default, so python2 programs have to be started manually, e.g. "python2 prog.py"
But sometimes that isn't enough either, so I found "virtualenv" which allows you to configure individual folders to work with an arbitrary python version.
First you configure the folder:
Then before you run anything in that folder, you must source the generated script:
But sometimes that isn't enough either, so I found "virtualenv" which allows you to configure individual folders to work with an arbitrary python version.
First you configure the folder:
virtualenv -p python2 ~/myfolder/
Then before you run anything in that folder, you must source the generated script:
$ cd ~/myfolder/
$ source bin/activate
$ ./some_python_app
Tuesday, July 8, 2014
Laggy USB MIDI Piano Keyboard
In Arch 64bit, USB Midi Piano keyboard is laggy when plugged in. Pressing a key gives a delay of about 100-200 msec.
I resolved this previously by upping timer resolution with:
sudo su -c 'echo 1024 >> /sys/class/rtc/rtc0/max_user_freq'
But it didn't work this time (I haven't used the keyboard in months) so I found https://bbs.archlinux.org/viewtopic.php?id=113019 where a similar problem occurred for a USB typing keyboard, but the same fix worked for me.
Be warned, if you are using a USB keyboard, it will likely stop working after the rmmod statements, I'm on a laptop so the built in keyboard kept working.
I resolved this previously by upping timer resolution with:
sudo su -c 'echo 1024 >> /sys/class/rtc/rtc0/max_user_freq'
But it didn't work this time (I haven't used the keyboard in months) so I found https://bbs.archlinux.org/viewtopic.php?id=113019 where a similar problem occurred for a USB typing keyboard, but the same fix worked for me.
$ sudo rmmod ehci_pci && rmmod ehci_hcd $ sudo modprobe ehci_pci && modprobe ehci_hcd
Be warned, if you are using a USB keyboard, it will likely stop working after the rmmod statements, I'm on a laptop so the built in keyboard kept working.
Friday, June 20, 2014
Paste symbolic link in KDE / Dolphin
Apparently there is no built in keyboard shortcut or right click menu option to do this, but you can hold down Ctrl+Shift while dragging and dropping.
Thursday, June 19, 2014
Linux PDF editing
For years I've had the occasional need to edit/modify/annotate PDF's and haven't been happy with options on Linux. This surprises me since Linux seems to be much more PDF friendly than Windows.
I just now realized that LibreOffice is a PDF editor, and seems to do a pretty darned good job of it.
I don't know how I missed it all these years, but here's hoping it fills the bill next time I need it.
I just now realized that LibreOffice is a PDF editor, and seems to do a pretty darned good job of it.
I don't know how I missed it all these years, but here's hoping it fills the bill next time I need it.
Unable to print to samba printer
Two times I have had to figure out why my network printer suddenly stopped working only to find out its because.... my root filesystem is full....
The issue appears to be the inability for cups to write to /var/spool/cups folder (due to lack of space)
A quick "df -h" reveals the filesystem to be full, I freed up 3 to 4 gig by simply clearing the pacman cache and problem solved.
The solution came from reading this post on bbs.archlinux.
The issue appears to be the inability for cups to write to /var/spool/cups folder (due to lack of space)
A quick "df -h" reveals the filesystem to be full, I freed up 3 to 4 gig by simply clearing the pacman cache and problem solved.
The solution came from reading this post on bbs.archlinux.
Friday, April 4, 2014
Python bitwise not operator
I had a strangely difficult time finding information about the bitwise not operator in Python.
The operator is the tilde (~) character, but since Python only uses signed integers (right?) you must and the result to mask off the unwanted portion.
The operator is the tilde (~) character, but since Python only uses signed integers (right?) you must and the result to mask off the unwanted portion.
In [1]: ~15
Out[1]: -16
In [2]: ~15 & 0xff
Out[2]: 240
In [3]: ~240 & 0xff
Out[3]: 15
Friday, March 28, 2014
Python notebook
I recently discovered the ipython notebook ability which is pretty sweet. Here are the things I need to remember how to do:
Set PythonPath to include own packages
In order to automate importing user created modules, you can create a file in ~/.local/lib/python3.4/site-packages (or whatever version you are using) that contains a list of paths to add to the PYTHONPATH
The more automated way to do this I got from this site.
%matplotlib inline
Load module code
Set PythonPath to include own packages
In order to automate importing user created modules, you can create a file in ~/.local/lib/python3.4/site-packages (or whatever version you are using) that contains a list of paths to add to the PYTHONPATH
The more automated way to do this I got from this site.
Magics
Plot graphs inline instead of in a separate window%matplotlib inline
Load module code
%load http://matplotlib.sourceforge.net/mpl_examples/pylab_examples/integral_demo.py
or
%load <path>/mycode.py
Friday, March 14, 2014
Proxmox: Use external VNC without inetd
Alex Harris on his blog gives a method for using external VNC viewer by modifying the VM configuration file as opposed to the INETD configuration which is what I typically see. Note: I have not yet tested this to ensure it works.
... go to the /etc/pve/nodes/proxmox/qemu-server directory. In the 1##.conf file (where 1## is the id of the VM), put the following lines:
args: -vnc 0.0.0.0:10
You can do this with each vm, just make sure the change the number after the last colon, as
each vnc connection has to be on it's own port. Then you can vnc using your favorite vnc viewer, and use the ip address/hostname of the proxmox server followed by a : and the number that's at the end of the line you put in the VM's config file. In this case it would be "vncviewer proxmox-machine:10"
Friday, January 10, 2014
Excluding folders when using find
Harder to find info on than I thought:
find /from/here -not -path "*/skipme/*"
find /from/here -not -path "*/skipme/*"
Wednesday, January 8, 2014
Emulating media keys with xmodmap
I got a new keyboard for Christmas, a mechanical one made using the same process as the old IBM model M ones.
The only issue is that I actually use my media keys to play/pause etc... and this keyboard has none, so using xmodmap and information from the Debian wiki and askubuntu I was able to remap the numeric keypad keys which I never use anyway to emulate multimedia keys.
The following sets "5" to play/pause, 8/2 to volume up/down, 4/6 to previous/next and 7 to mute/unmute.
File "xmodmaprc"
The only issue is that I actually use my media keys to play/pause etc... and this keyboard has none, so using xmodmap and information from the Debian wiki and askubuntu I was able to remap the numeric keypad keys which I never use anyway to emulate multimedia keys.
The following sets "5" to play/pause, 8/2 to volume up/down, 4/6 to previous/next and 7 to mute/unmute.
File "xmodmaprc"
keycode 79 = XF86AudioMuteCommand to run
keycode 88 = XF86AudioLowerVolume
keycode 80 = XF86AudioRaiseVolume
keycode 84 = XF86AudioPlay
keycode 83 = XF86AudioPrev
keycode 85 = XF86AudioNext
xmodmap xmodmaprc
Tuesday, January 7, 2014
Using comm to find unique or common lines between 2 files
Use comm to compare files and show only lines that are unique, requires files to be sorted.
With no options, produce three-column output. Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and column three contains lines common to both files.
Any of the columns can be supressed by adding -1, -2 or -3.
Example: Compare fileA.txt and fileB.txt and show only lines that are unique to fileA.txt
With no options, produce three-column output. Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and column three contains lines common to both files.
Any of the columns can be supressed by adding -1, -2 or -3.
Example: Compare fileA.txt and fileB.txt and show only lines that are unique to fileA.txt
comm -2 -3 <(sort fileA.txt) <(sort fileB.txt)
Subscribe to:
Posts (Atom)