Fixing PyInstaller on Mac Yosemite

I tried to install pyinstaller using PIP:

<code>$ pip install pyinstaller </code>

and this installed PyInstaller version 2.1, as you can check using

<code>$ pyinstaller –version</code>

When I tried PyInstaller to one of my python script, it gives me an error. I run PyInstaller in this way:

<code>$ pyinstaller</code>

Then I got the following error:

<code> struct.error: argument for ‘s’ must be a string</code>

The error is caused from a file


from line 84 and 367. To solve this, I replaced the following lines:

Line 84

<code> rslt.append(struct.pack(self.ENTRYSTRUCT + repr(nmlen) + ‘s’, nmlen + entrylen, dpos, dlen, ulen, flag, typcd, nm + pad))</code>

with the following:

<code> 84: rslt.append(struct.pack(self.ENTRYSTRUCT + repr(nmlen) + ‘s’, nmlen + entrylen, dpos, dlen, ulen, flag, typcd, nm.encode(‘utf8’) + pad)) </code>

and Line 367

<code>cookie = struct.pack(self._cookie_format, self.MAGIC, totallen, tocpos, self.toclen, pyvers, self._pylib_name)</code>

with the following:

<code>cookie = struct.pack(self._cookie_format, self.MAGIC, totallen, tocpos, self.toclen, pyvers, self._pylib_name.encode(‘utf8’)) </code>

After that, my pyinstaller works.

After msfupdate, postgresql selected, no connection

After I did a “sudo msfupdate”, somehow my msfconsole is not connected to the database. when I type:
msf> db_status
postgresql selected, no connection

So, to connect back, I need to provide the location of database.yml, as in

msf> db_connect -y /usr/local/share/metasploit-framework/config/database.yml

And it connects again. yeah. To do this everytime msfconsole is called, we can create an alias in .bashrc.

alias msfconsole='msfconsole -d db_connect -y /opt/framework/config/database.yml'

Installing Metasploit on Xubuntu 14.04

  1. Grap the script file from:
    $ wget
  2. Run the script.
    $ chmod a+x ./
    $ ./
  3. Now, by right, we can start running msfconsole, but I got some error when I tried to do so.
    $ msfconsole
    /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- /usr/local/bin/config/boot (LoadError)
    	from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    	from /usr/local/bin/msfconsole:23:in `'
  4. What I did was to edit /usr/local/bin/msfconsole line 23, and replace that line with:
    require File.expand_path('/usr/local/share/metasploit-framework/config/boot.rb', __FILE__)
  5. Make sure that the path for config/boot.rb is correct for your system.
  6. Now, when I run msfconsole again, it gives me some warning of missing permission to write some log file.
    Rails Error: Unable to access log file. Please ensure that /usr/local/share/metasploit-framework/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
  7. So I need to create the directory and make sure it is accessible.
    $ cd /usr/local/share/metasploit-framework/
    $ mkdir log
    $ chmod 777 log
  8. Now, I can run msfconsole. Before reaching the prompt, however, I got the following warning:
    [-] WARNING! The following modules could not be loaded!
    [-] 	/usr/local/share/metasploit-framework/modules/auxiliary/scanner/smb/smb_login.rb: LoadError cannot load such file -- robots

Fixing Missing “Articles from Pocket” from Library Menu in Kobo Aura

When I bought Kobo Aura eReader, I could not find Pocket from the Library Menu. It turns out that for Kobo aura from Japan, the firmware is set with different affiliate. Changing the affiliate solves the problem.

These are the steps:

  1. Connect Kobo using USB to PC
  2. Go to the hidden folder “.kobo”
  3. Inside that folder, there is a text file called “affiliate.conf”
  4. Change the value from Rakuten to KoboIndigo


Fixing box error sync problem for package files in Mac OS X

I have been using Box Sync with Mac OS X for quite some time and recently I encountered some issues with syncing. I began to use some software like Scrivener and Omnigrafle that save the files as package files (which is a folder). However, Box Sync currently does not support this. The error message is shown in the figure below.


The website suggested to save the file either as flat file or compressed zip file. Omnigraflle supports flat file saving, but scrivener still gives an issue. And zipping the files everytime I finish using scrivener is not something I want to do. So resolve to the following steps.

  1. write a small script to zip the file (or folder?).
  2. Use Lingon 3 from Mac App store to schedule running the script periodically.

The package files still cannot sync with, but now the zip file sync. So you can always unzip it to restore it somewhere else.

Moss command to compare spice files

./moss -l spice -b base_files/lab3_base.jsim -m 3 test/Lab3/*.jsim test/StudentSubmissions/3/*.jsim

-l spice : compare spice format files

-b basefiles: to be ignored, e.g. lecturer supplied codes

-m N: number of passage to be ignored. -m 3 means that after 3 occurences it is considered like base file

files… : all the files you want to compare

Recreating database after modifying django models

Sometimes I needed to change my django models, and it might create error that certain column cannot be found. If you have not much data yet, the simplest is to recreate the database. This is the step:

Go to mysql client:

<pre>$ mysql -u root -p mysql</pre>

Show the databse

<pre>mysql> show databases;</pre>

Drop the database

<pre>mysql>drop database databasename;</pre>

Create database

<pre>mysql>create database databasename;</pre>