Tuesday 22 July 2014

How to create a bootable usb drive from an .iso in the command line on Linux

Mr. Borgstrom has an excellent article for creating a bootable usb key from an iso in the Terminal on Mac. Now that's great and all, and i have used his method for many installation setups on Mac,
but I am constantly looking for ways of doing things on Linux. After some experimentation I created a bootable usb drive of Kali Linux with only a few commands.

Linux is VERY good for working with disks and that sort of thing once you get the hang of it.
You'd be surprised at the power you can muster at a good old command line.
In fact, i have found myself using more and more of the Terminal on Mac for just regular everyday stuff, like moving files rather than dragging and dropping in Finder.

Objective:

In this article i show you how you can create a bootable usb drive from an .iso image which you can then you to run your live Linux system from or proceed however you see fit.

This should only take a few minute for you to accomplish (the bulk of the time is copy the image to disk).

What you will need:

  1. A GNU/Linux system
  2. and USB thumb drive with enough room to fit your iso
  3. sudo or root access
  4. An ISO image of the Linux distro you want to boot

What I will be using:

  1. Linux Mint 17 64bit (not primarily for the desktop, but for the stability and versatility.)
  2. 8GB USB Flash Drive
  3. kali-linux-1.0.7-amd64.iso (2.96G) Kali Linux Hackers Distro

Procedure:

Step 1: Plug in your USB flash drive and find its identifying path

Before you plug in the flash drive, enter:

~$ fdisk -l

See which disks there are.

Plug the drive into the computer, find its identifying path with:

~$ fdisk -l

The drive is there that wasn't before in the previous fdisk -l, is the one you wan't to use.
Confirm that the disk sizes are that of the flash drive. Should be something like /dev/sdb or
/dev/sdc

I identified it by its size. Mine is 8GB
The root identifier (not a certain partition) is /dec/sdc


Step 2: Delete all partitions on /dev/sdc and make free space

Now we want to make the flash drive into purely free space.
We will use cfdisk to accomplish this from the command line.
Double check that you know which device your flash drive is. If the next command is performed on
the main hard drive, there could be irrecoverable data loss and system damage. You have been warned.

~$ cfdisk /dev/[your device]
e.g
~$ cfdisk /dev/sdc


Now what you see here is the Textual User Interface of cfdisk. Also since i used this particular flash drive for a previous usb installation, you will see that "Kali Live" of the iso9660 type is the boot partition.

We want to delete all partitions to its just free space.

For each partition, unless its already free space, use the arrows keys to navigate over it, the delete it like this:

 Hit enter.

You should now have this:

Write the changes to disk by pressing enter when the [ Write ] button is activated. Confirm by entering :yes

Quit cfdisk.

Step 3: Copy the image to the flash drive

The rest of the process is really is waiting on one command to complete.
We now want to copy the .iso to /dev/sdc or whatever device is yours.

Make sure the iso you want to boot is in your working directory (~ or something)

Do the copying:

~$ dd if=./kali-linux-1.0.7-amd64.iso of=/dev/sdc ibs=4M obs=4M

You have to wait for this to complete. DON'T STOP IT if you get impatient.
For me this command took about 15 mins.
The time it takes depends on a few factors.

  1. The size of the image you wish to copy
  2. The write speed of of you flash drive
  3. The block size (We used block of 4M to speed it up. Don't use ibs, bs, or obs over 20M)

Once dd is done, you should see something like this:


Hey, we discovered the write speed of our flash drive by accident! Mine is 9.5 MB/s

You should now be able to boot into the flash drive normally.

If you wish to thank me you can comment or even consider subscribing.
Otherwise, i hope this was helpful.

Cheers,
Rudker


Friday 28 June 2013

CW PvP ~



CapitalWorld PVP
Hello all, I'm Rocky. Before I show you my story I want to tell you about some stuff. Ok, well this one is on CW. No it's not an actual story. I will be talking about Plugins, actual story's and More. I hope you enjoy it guys!
It all started when Lakeol was messing around with his Flame Bow. It was about 4:50pm on June 30th when he shot it up in the air. Xxrocky65Xx and Peng55 had just finished the base. About 2 or 3 hours later we saw Lights. Lots of them! We all knew we should get our Armour on, so we did. Peng55 then yelled out “PENG55 WATCH OUT!” Next second he gets an arrow to the leg! He couldn’t fight. The whole night Lakeol and Xxrocky65Xx were fighting them. It was about 5am in the morning when we killed the last guy. We had a look at there Armour and saw that they were apart of the Faction “KoE” ( Knights of Ender). We were all scared. Lakeol carried Peng55 and we all walked to the City of CapitalWorld. In CapitalWorld we met up with the Faction KarmaPvP. KarmaPvP  was  a Strong faction and hasn’t been raided. Back in the day KarmaPvP was only a small faction. It had been raided quite a lot and no one liked them. Today KarmaPvP is a strong and un-raidable Faction. We were looking around  their “f home”, and looked at their items they collected from killing People. They had Swords and Bows to spare, Armour and more. We were greatly happy to be with them. We heard a noise, we looked over and saw the best PVP’er walk in. His name was vMystery. He gave us all spare armour, as he had just returned  from a raid.

The next day everyone went out looking  for bases and food. Lakeol, Peng and I, stayed back and had another look at the base. It was about 5 minutes later and we heard a bomb go off; we weren’t quite sure what it was. Lakeol saw another person walk in and said “what the…” they shot Arrows at Lakeol. Lakeol ran and hid. We all popped our Armour on and fought. We killed at least 13 of them, then ran. We saw a person named XxBowzxX coming up. We thought he was gonna kill us but instead started helping us. He had killed a lot, as in 35 people at least. The 4 of us then ran for our lives. We got out alive but saw the base blew up. We all knew we’d been raided. We didn’t quite see what happened to KarmaPvP; All we knew is they didn’t have a base (lol). We wanted to get revenge on them, sometime we will. For now we’ll be a little faction hiding away, named “Deception”. Yes, we’ll be raided but we will end up being Strong as KarmaPvP was. At least we got most of their items. we’re Building a base when we find more land away from others.  It was only after a month later, that Peng’s leg got a lot better. We were all back in the game;we had Armour and Swords . Now, time to go raid those people!!
To be Continued

New Author, ~Rocky

Hello Readers,

I am happy to present to you my first Co-Author here at Rudker's Software Corner.
His name is Rocky, and he will be writing on a variety of topics mainly to-do with Minecraft Servers and plugins; Capital World especially since that is one of our sponsors. In addition to that, he might grace us with some short fiction or even poetry!
In Rocky's first post he will be doing what he does best; telling storys; and he's starting off with a real life PVP experience. Hope you enjoy, and good luck Rocky! Welcome Aboard.

Amazing, Free mind-mapper Xmind for Mac, Windows, and Linux




I hope this post will bring to your attention a free tool that has now become a great help to my everyday
life. The credit goes to a mind-mapper called Xmind; available for download (or purchase for premium features like more exporters.) at www.xmind.net
I absolutely love this thing. I can do everything in it. From organizing my thoughts, to planning my day, to solving problems, to starting and finishing projects. There are so many features and pros about this software, that I would recommend to pretty much anyone. 

I particularly have an intrest in the idea and practice of mind mapping. Getting an image of your mind out there on paper, presenting your thoughts in a structured, visual, and logical representation. I have tried other mind-mappers, but just dont find them as fluid and flexible as Xmind. Take Freemind for instance. Its what I started with but it's only good for completely structured mind mapping. You have to have a strict hierarchy. No multi-maps projects, no free-floating nodes, no lines for creating manual relationship between non-directly relating nodes. Xmind has all this and more.

Heres a map I made in xmind before i made this post. No need for a thousand words! All i wanted to say is simply covered in the mind map. No fuss. No Fluff.

(Click for larger view)

One of my favorite things to do with xmind is take notes. You can go so fast because it can be fully keyboard controlled, and you keep track of what leads to what during a conversation or lecture.

Anyway, thats far from all there is to this monster, but there you go; Thats my two bits. Enjoy. And I hope it helps you in some shape or form as it has me.

Saturday 2 March 2013

Game Latency (Lag), Traceroute, Zenmap and Network Troubleshooting

Gamers and computer guys are similar in a few ways.  One way i would go so far as to say this is their desire for no lag, or latency.  A website designer hates when it takes so long to load a Wordpress.com page and a gamer hates when his "lag" is over 300 in an intense FPS.  There are many other scenarios, but I am here to tell you some of the ways i have learned to troubleshoot things like network speed, lag, latency and the like.

Before we proceed I will tell of a few necessary fundamentals you need to understand the following concepts. 

What is lag?
There are two kinds of "lag". Lag normally refers to hardware lag on the user's side such as Frames per second in a game. (FPS) or a freeze of the screen, and the spinning wheel of death on mac, or a "Glitch"

The other kind of lag, Latency, or the more understandable term: "Response time." It is the response time between the computer you are are, and the computer or server you are connected to. This also a cause of great distress for people who are particular about their internet speed. This network latency lag is what we will be talking more about.

What is the Internet really made of?
To understand what i will be telling you next you must understand this; the Internet or more properly defined in these terms, Intranet, is a globally wide connection or web of interconnected computers. (Experts, correct me if im wrong, but I think this is generally understood as the Intranet.)
Not to bore you with theory and history of the internet, but its not quite that simple. Sure, we could run cables from one computer to the next, and then from that computer to the next and so on but that would make it more big and bulky then the Internet needs to be. What is between the computers is what we are interested in. Its something most of us don't pay that much attention to. And for most of us its unnecessary but for some of us that run into problems, we want to know why they are happening, and how to solve them. 

There are hundreds of kinds of devices that lie between you, another country and a website. Plainly put, these devices comprise mostly of Switches, Routers, Domain name Servers, Your internet service provider, and large telecommunications cables that go under the sea. Or, smaller ones that go to the office or house next door.

With the continued use of the Internet Protocol Version 4, which allows only 4,294,967,296
addresses because of its addressing protocol, we couldn't just use a bunch of cables, connect everything and give every device an IP of its own. There are too many devices! We did, but we have more devices than that. So what we did next was make use of the idea of subnetworks and Local Area Networks (LAN).

 Now subnetworks is getting into a pretty complicated matter, so i will simplify. You have a main network, that is the internet, then attached to that network are smaller networks, often defined by entities such your ISP or a corporation or a hosting company, then, attached to those networks is you home LAN, your LAN has both an internal and an external IP in most cases, your router or firewall makes this possible. Your LAN gives you your very own mini-internet and each of the computers on that mini-internet have an IP address.
There is more in between you and a website, but those are normally hundreds of connections, not networks.

Heres how we can see those connections.

Traceroute
Traceroute is a multi-platform command line network diagnostic tool. And its named is very explicably chosen. It does what is sounds like. It traces routes. It traces routes, known as hops or nodes between the computer you are running it on, and your target. You target can be an IP address or a url such as:
www.google.com
You put in the the target address, run the trace, and it gives you the address (and more information) of all the nodes in between. AND LAG TIME!!! If you know what the program ping does (comment if you don't) its basically that, but it pings every node and the shows you the total ping time between you and the target address.
It is used on *NIX systems for the most part, but is open sourced and written in a language supported by all operating systems.

I use a Mac, so if you want to follow along it is included on every mac natively:


  1. Open up a Terminal.app window and type the following:
  2. traceroute www.google.com
Let it do its work, and when its finished you should see something like this.


Starting from the top you can see the command I entered, then the program starts to give its opinion of things. It tell us that www.google.com has multiple IPs, but its chooses the nearest. Thats how google works with so many people to serve and only one simple domain name.

Then it shows you each of the nodes on the route to the google server its trying to reach.
We can see at the bottom that there are a total of 12 hops from us and the server.
The last of the 3 pings is what you need to worry about. (Not sure what the other millisecond readings are. O.o)

OK, so what is this doing for me? How can it help me?
Well, lets say you were looking for a server to join for a game such as Minecraft. And you have the IP of 2 servers you are looking at. You could take those, replace www.google.com with the address of the server and run the program. Run it for both of the IP's and you can see which server will have the fastest response time. Generally the server that returns the fewest hops, will be best for you. (This does not measure CPU lag that is often a cause of lag in Minecraft servers actually, this is pure network.)

Is there any GUI version of this... traceroute? Its too many numbers! Im more visual!
Your in luck. Fortunately the guys over at nmap.org have created a GUI program called "zenmap" for the incredibly powerful command line program nmap. Now nmap is something quite juicy and will require another post for me to go into detail, but i think that with this background i have given you, you will be able to discover nmap for yourself (As nmap is the default function of zenmap and the traceroute is a subroutine that is just accessing that program for you.)
Download the program then I will show you how to do traceroute's in it.

This is the screen you get when you open it by default. Pretty self explanatory.


I will input the IP of my favorite Minecraft server and choose "Quick traceroute" from the Profile drop-down. Feel free to experiment with the other types of scans! (Curtain laws may apply in certain jurisdictions. ) Ask question in the comments if you like.



After the scan, this is what is returned


MORE NUMBERS!! No, wait, thats not all.
Switch to the Topology tab.


Yeah man! Now thats what im talking about!

Now, without closing the program put in a new address and run the quick traceroute scan again.
Then look at the topology map now and surprise yourself.
Now you can map out the whole internet! No, not really. It would crash your computer and you probably wouldn't see anything displayed. (I tried over 21,000 nodes once! And it froze LOL)



Oh, one more thing i forgot. In the controls toolbar, change the option so you can see latency displayed.


There are tons of other things that amazed me by just clicking around in zenmap. Go for it.

Thank you for reading, please comment and feel free to ask questions if you like.















Thursday 3 January 2013

Understanding Apache Virtual Hosts, creating one in 6 steps

I have been using Apache2.2 web server for numerous applications as long i can remember. (4 years) And until last night i have been missing out on the real power behind the software and its ability to create virtual hosts. Now i have like 5 websites running on one server with the power of virtual hosts in Apache2.

It was one of those late nights that every student studying System Administration and Networking gets.
Out of necessity i was forced to finally break the brick wall between be ABLE to make an apache virtual hosts and NOT being able to create one.

It is from many blogs such as these and the long-lasting and extremely helpful *NIX community that i finally pieced together how to do it. I dont just write this to say i did it (Although i threw my hands up when i did) im writing this to contribute to the community of learners and teachers out the in the computer world. Hopefully i can simplify the steps down to their bare bones.

What you are trying to achieve:

  1. You want to serve multiple websites, but you only have one server....... CAN YOU? YES!
  2. Do something you thought you couldn't....... CAN YOU? YES!
Prerequisites:
  1. Linux Server (Debian or Ubuntu Server Edition Recommended - i use Debian)
  2. Apache web server 2.x
  3. Terminal or Shell access (Either through telnet, or SSH)
  4. Root or Sudo access Preferably (Not sure if needed, i will get back to you.)
  5. A domain. You need be able to create subdomains. Preferably from www.no-ip.com (They have free ones you can have 50 subdomains for any premium domain you buy, i own rudkerfern.net. I use it for testing. Its also my Minecraft IGN :p)
My Model System:
  •  I am using Debian GNU/Linux 6.0.6 Codename "Squeeze"
  • I am on an Apple Network with IP adresses that build upon the 10.0.1.0 framework (no 192 for me :p) 
  • I will be using sub.example.com as the example domain (sub.* means any subdomain you created)
  • I am doing most of my administration on a mac and ssh'ing in.
Note: "$" stands for the Linux Terminal Prompt

I did this on my home system so i have a dynamic IP (changing every few days) and premium domain registered at www.no-ip.com. You can still do this if you have a static IP. I will leave notes to tell you what to do if you have a static IP. I also have a firewall which mean i had to port forward the respective ports for anything i wanted to access on the inside from the outside world. You will need to do the same. I have another tutorial on port forwarding.

We will be using the standard http port 80
Nothing special.
Anything enclosed "<  >" means you need you fill in YOUR respective value
WE WILL BE MAKING A NAME-BASED VIRTUAL HOST

Let get started.

STEP 1, get shell access:

SSH or telnet into your server if you dont have physical access
Open up Terminal.app on Mac and enter the following


$ ssh <user>@<host/ip>

Example $ root@www.example.com

If you need to do this in Windows, you will need a telnet/ssh client called http://www.putty.org/
It works in a similar fashion.


STEP 2, get in the right directory:

On my Debian system the directory with all the configuration virtual hosts in under
 /etc/apache2/sites-available

$ cd /etc/apache2/sites-available



STEP 3, write the configuration:

Now that you are in the right directory you can make the config file with my favorite text editor "nano"


$ nano sub.example.com
Heres all i needed to get a virtual host working.
You can copy this over and edit it to your needs.


<VirtualHost *:80>
        ServerName sub.example.com

        DocumentRoot /path/to/files/to/serve
        <Directory /path/to/files/to/serve>
                Options FollowSymLinks
                AllowOverride None
                Order allow,deny
                Allow from all
        </Directory>
         </VirtualHost>

You will need to change "ServerName" to the subdomain you setup with your domain registrar.
And change "DocumentRoot" to the directory that you want to server files from

"<VirtualHost *:80>" just says that you are listening to all requests from all ip on port 80
You can of course add any other standard apache2 directives into this config file for this particular site.

You might be interested in the "AllowOverride" directive. This tells apache2 wether or not to use Authentication for people that are requesting anything from this site. None means NO authentication. The only option i use would be "AuthConfig" instead of "None" on the "AllowOverride" directive.

Now

ctrl+o and the <ReturnKey> to save
and ctrl+x to exit nano

STEP 4, enable the newly configured site:
You can use the apache2 tools "a2ensite" and "a2dissite" to enable and disable site configs respectivly


$ a2ensite sub.example.com
It should enable the site and give you the next step. For you guys out there that HAVE to know what apache just did for you, here it is: it created a Symbolic Link aka an "Alias" on desktop systems in
/etc/apache2/sites-enabled/sub.example.com
If you want to see more on that, cd that directory and try the command $ ls -la
You will fond some interesting things next the site config file ;)

STEP 5, reload apache2:
Yep, what the step says...

$ /etc/init.d/apache2 reload



Apache is very good  at debugging config files, if something is wrong it will tell you what and where.
If you got no error then stand up and shout! You did it. No wait, never jump to soon, there will be plenty time for that, lets test it first!

Go to your browser and type in "sub.example.com" or whatever you domain and subdomain address is.
If you have nothing in the folder you wanted to serve from and it give you and "Index Of" page then you are in luck buddy. It worked, simply put in your content. E.g an index.html or index.php page.
  


STEP 6, post a comment if you have any problems:

Go ahead! Bring it.


Notes: to disable a site just use the "a2dissite <sitefile>" command then reload apache.










Wednesday 18 April 2012

How to Port Forward on a DLink router for your server

It just hit me that most people in the world use Windows, (duh) so i had better do a quick tutorial on
port forwarding for various servers on a non-apple router, i will be using a DLink as an example.
Port forwarding on a Dlink is just as simple and straight forward as on an Apple Time capsule
or Airport Extreme.
Why would you need to Forward a port?
Simple answer: so people can access you server from outside you LAN or Local Area Network.
So lets get to it.
Note: this tutorial was requested by a Minecraft player i know by the name of Veyleus. ~Hope this helps :)

What you will need >>>

  • Username and Password to your Dlinks admin page
  • 5 minutes of time if all goes well
  • 7 minutes if you have trouble and need to ask a question on the mini-forum

Step 1, how to access the routers admin page:



First you need to determine if your Dlink will let you access the admin page via wifi.
Some dont allow this for security reasons. But you can change that setting.
Open up and browser and type in 192.168.0.1 this is the default address for a Dlink router
For a Linksys and most other router its 192.168.1.1

If you get a page not found or and you cant connect and itsnot prompting you for a username and
pasword, then its probably not allowing wireless administration. To fix this find an old Ethernet back in the back of your desk drawer and plug in one end to your computer and the other to the back of your router in the Ethernet port. (Assuming that you have a laptop and can go to where your router is or have a long enough Ethernet cord)

Then just enter the same address: 192.168.0.1 in your browser.
It should supply you with 2 fields to enter you password and user name.
The default to Dlink routers is Username: admin Password: private

But normally the password is not the default one, you have to know that password or ask someone who does.

If all go well the admin page should be served up.

Step 2, forwarding the port:

Click the "Port Forwarding" button on the side, a page similar to this should be displayed



Move down to where you see a table like this:


Pick and name of you choice. e.g. Mincraft server.
Then for IP Address put the local ip or you computer, you should know how to find the local ip of your computer but if you don't, drop me a comment. 

Under ports to open:
Put a range of ports instead of just one port, i find it works better for server FTP servers and Minecraft.
For Minecraft i would put the ports like this: 24000-26000 assuming you Minecraft server is running at the default port of 25565.
Put the same port range both the TCP and UDP fields.
You can leave the "Schedule" and "Inbound Filter" selection boxes as they are shown in the image.

Step 3, saving changes and testing:

Click save changes at the top and let your router do its thing and reconfigure.

After that to test it, turn on your server and test it with your local ip to confirm it is working and serving.
Then find your external IP and whatismyip.com and then you that ip to connect instead.

If you can connect to your server using your external ip then grab a bag of pretzels and a glass of Koolaid and just marvel at how you were able to get it to work the first time you tried it :)

But things never work the first time with me so if you have any trouble, drop me a comment and i will see if i can help.

Trouble Shooting:

Some routers may not support ranged port forwarding, so instead of putting 24000-26000 for the ports, just put 25565 or whatever port you are looking to forward.

Some routers may also not allow outside connections from your local network. So you might need to go a to a friends house or an internet cafe to test it. But this is rarely the case.

Make you that you server is running on the port you think it is and that you port forwarded that port.