hild1.no

Kagee's random rantings

Changing the Subnet Mask in Vmware Workstation on Debian Jessie

(updated )

I’m currently attending SANS SEC504: Hacker Tools, Techniques, Exploits and Incident Handling in London. For some of the labs in the course we need machines on the IPs 10.10.0.1 and 10.10.71.1 with a subnet mask of 255.255.0.0.

Changing the Subnet Mask for the NAT or host-only networks in VMware Workstation seems like such a easy thing to do. According to VMware it should be as easy as opening the Virtual Network Editor and “type a new value in the Subnet mask text box”.

Oh wait … I can’t change it. The field for subnet mask in the Virtual Network Editor is not editable.

Manual Deobfuscation of a PHP Snippet - Part 1

(updated )

In late July the following question was posted on a IRC-channel i frequent:

Anyone care to devise what an obfuscated PHP payload does?

Sure, why not, sounds like a challenge. This is part 1 of a series of blogposts explaining the headache-inducing three hours that followed.

Octopress: Let's Try Something New

(updated )

Sooooo, i got kinda tired of wordpress, and felt like testing something static, and a little closer to my terminal.

Enter Octopress

Connecting a POTS to Mumble Maybe? - an Idea

(updated )

So, the problem: Moving from Skype (closed source) to Mumble for meetings, while still having the possibility to conference with the occasional user of a POTS (plain old telephone system)

Dynamic DNS (IPv4 and IPv6) With Linode

(updated )

Do you have have free dynamic DNS through no-ip.com?

Your free host hildenae.no-ip.org, will expire
in 7 days due to account inactivity.

hildenae.no-ip.org was last updated on <some-datetime-in-the-past>. Free Dynamic DNS hosts must be updated by logging into your account on our website and clicking update, this must be done every 30 days. If you are using the Dynamic Update Client and your IP address has not changed within the past 30 days, you must manually update it to prevent them from being removed from our system.

Yeah. With a mostly static IP from my school, that started to get annoying after five or six times.

Trekke Ut Deler Av Et Git-repository, Og Samtidig Ta Vare På Historie

(updated )

Clone

1
2
3
4
5
6
7
8
9
10
11
12
git clone git@github.com:Kagee/fixmystreet.git
Initialized empty Git repository in /home/hildenae/tmp/fixmystreet/.git/
remote: Counting objects: 10461, done.
remote: Compressing objects: 100% (3306/3306), done.
remote: Total 10461 (delta 6802), reused 10276 (delta 6713)
Receiving objects: 100% (10461/10461), 10.10 MiB | 497 KiB/s, done.
Resolving deltas: 100% (6802/6802), done.</p>
<p>cd fixmystreet/</p>
<p>ls
android  bin  commonlib  conf  db  iphone  LICENSE.txt  locale  notes  perllib  README.pod  t  templates  web  web-admin</p>
<p>ls android
Fix My Street  README.txt  Screenshots  TODO.txt
Do some magick
1
2
3
4
5
6
7
8
9
10
11
git filter-branch --subdirectory-filter android -- --all
Rewrite 33db13154330e9e7a33c0fb5c356eccb25a6edda (36/36)
Ref 'refs/heads/master' was rewritten
Ref 'refs/remotes/origin/master' was rewritten
Ref 'refs/remotes/origin/cities_release_1' was rewritten
WARNING: Ref 'refs/remotes/origin/master' is unchanged
Ref 'refs/remotes/origin/migrate_from_osgb36_to_wgs84' was rewritten
Ref 'refs/remotes/origin/migrate_to_catalyst' was rewritten
Ref 'refs/remotes/origin/reportemptyhomes' was rewritten
ls
Fix My Street  README.txt  Screenshots  TODO.txt
Change origin
1
2
3
4
5
6
7
git remote -v</p>
<p>origin   git@github.com:Kagee/fixmystreet.git (fetch)
origin    git@github.com:Kagee/fixmystreet.git (push)</p>
<p>git remote set-url origin git@github.com:Kagee/fiksgatami.git git@github.com:Kagee/fixmystreet.git</p>
<p>git remote -v</p>
<p>origin   git@github.com:Kagee/fiksgatami.git (fetch)
origin    git@github.com:Kagee/fiksgatami.git (push)
Push
1
2
3
4
5
6
7
8
hildenae@hildenae-laptop:~/tmp/fixmystreet$ git push origin master
Counting objects: 464, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (243/243), done.
Writing objects: 100% (464/464), 1.44 MiB, done.
Total 464 (delta 159), reused 428 (delta 158)
To git@github.com:Kagee/fiksgatami.git
 * [new branch]      master -&gt; master

Enabling VNC and Disabling Desktop Effects From the Command Line

(updated )

Don't you just hate those day when you really need to access the desktop of a machine, but forgot or just never activated remote desktop?

Fear not, the following lines will let you activate it from a SSH-shell:

[code language="bash" light="true"]
# display number, assuming 0
display=0

# get the machine-id
read -r machineid < /var/lib/dbus/machine-id

# source the right file under .dbus to set the needed variables
. "$HOME/.dbus/session-bus/$machineid-$display"

# export the variables sourced from that file
export DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID DBUS_SESSION_BUS_WINDOWID

# Run gconftool-2:

# enable desktop sharing
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true

# disable "You must confirm each access to this machine"
gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false

# enable "Allow other users to control your desktop"
gconftool-2 -s -t bool /desktop/gnome/remote_access/view_only false
[/code]

Remeber to set a password after you log in (afaik you can't set this from cli)

I use the propiatary ATI drivers, and because of a bug i have to disable desktop effects, else the VNC windows will only show me a static desktop and no updates:

[code language="bash" light="true"]
# disable desktop effects (if your desktop
gconftool -s -t string /desktop/gnome/applications/window_manager/current /usr/bin/metacity
gconftool -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity

sudo reboot
[/code]

Sources

https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/353126
http://ubuntuforums.org/showthread.php?t=1518231

SyntaxHighlighter Evolved With Inline-highlight

(updated )

After i first posted code for highlight-range i made some small changes to the code in the post as i found better ways of doing things. When i inserted new lines it messed with my highlighting. Inspired by pastebin.com, i wrote a couple of lines that let me specify with a marker in the code (and not by line-number) what line should be highlighted.

Update: Added @hr@ for inline-ranges.

The second codeblock is inside a shortcode similar to this:

[code language="plain"]
[code language="php" firstline="736" gutter="true" highlight=""]
[/code]

All the highlighting is done by @hr@-tags on line 740 and 761. Lines 747, 751 and 754 are prefixed with @h@ to show that single lines inside a (possibly) large highlighted range can be excluded. Both marker tags are removed and do not appear when displayed or in code-view.

[code language="php" firstline="736" gutter="true" highlight=""]
// Automatically enable "htmlscript" for certain brushes
//if ( false === $atts['html-script'] && in_array( $lang, apply_filters( 'syntaxhighlighter_htmlscriptbrushes', array( 'php' ) ) ) )
// $atts['html-script'] = 'true';

@hr@ // Detect and add inline highlights (@h@) and ranges (@hr@)
$codelines = explode("n", $code);
$h_marker = '@h@'; $h_marker_length = strlen($h_marker);
$h_range = '@hr@';
$atts['firstline'] = (int) $atts['firstline']; // sanitize firstline as we need it
$hra = false; $h = false;
foreach($codelines as $linenum => $line) { // could have used &$line, but that is php5-only
@h@ if($h_marker == substr($line, 0, $h_marker_length)) {
// could have used "$line =" in php
$codelines[$linenum] = substr($line,$h_marker_length, (strlen($line) - $h_marker_length));
$h = true;
@h@ } else if($h_range == substr($line, 0, 4)) {
$hra = !$hra; // we swap on/of ever time we detect the tag
$codelines[$linenum] = substr($line,4); //, (strlen($line) - 4));
@h@ }
if($h xor $hra) { // we use xor so we can use a @h@ to escape a active $hra
$atts['highlight'] = ($atts['highlight'] == false) ?
($linenum + $atts['firstline'] -1 ) :
$atts['highlight'] . ',' . ($linenum + $atts['firstline'] -1 );
}
$h = false;
}
@hr@ $code = implode("n",$codelines);

// Sanitize row highlights
if ( false != $atts['highlight'] ) {
[/code]

New syntaxhighlighter.php with the inline-highlight-code based on SyntaxHighlighter Evolved version 2.3.8

New syntaxhighlighter.php with the inline-highlight and highlight-range-code based on SyntaxHighlighter Evolved version 2.3.8