This is yet another article about Batch files. In this article, I am going to show you how to read a text file line by line using the Batch files scripting language.
For more advanced Batch scripting topics, please grab a copy of the Batchography book.
Hiew+ is based on the FsPlus project. FsPlus is an implementation of an idea that allows you to access non disk files as if they were disk files. Hiew+ is a real life example of FsPlus where we take Hiew (an excellent hex editor) and turn it into an excellent process editor. Each process will be viewed as a file with a size as much as SYSTEM_INFO.lpMaximumApplicationAddress returns. In theory FsPlus should work with any hex editor to provide process memory editing, but this release is just Hiew ready.
Usage
To use FsPlus, you need to inject FsPlus.dll into Hiew’s process memory so that the APIs are hooked. After APIs are hooked, FsPlus will recognize and treat in a different manner any file name that has the following form: “pid|1234” where 1234 is a given PID. To make the usage even simpler, I provid a small GUI (FsPlusGui) to allow you launch Hiew conveniently.
In fact, Hiew+ can be considered as a nice addition to your reverse engineering tools arsenal (IDA Pro‘s debugger or any other debugger, etc.).
Here’s a screenshot of the FsPlusGui:
You will need to double click on a process to have Hiew or the desired process launched with FsPlus support.
Make sure you specify the settings correctly in FsPlus.ini:
After you run it successfully, you will be able to start editing processes as if you were editing files. The catch is every process virtual address is now a physical offset in Hiew.
Modules as IMAGE_SECTION_HEADERs
For your convenience we have created additional IMAGE_SECTION_HEADER structures in the PE header of the main process, so that each loaded module is view as a PE section:
Textual information about process’ modules
In addition to viewing modules as PE sections, you will have an actual representation of all loaded modules just after the end of the PE header:
Do you want to master Batch Files programming? Look no further, the Batchography is the right book for you.
Available in print or e-book editions from Amazon.
No Read Errors
To avoid reading errors and such, any unreadable memory page is filled with “BAD!” pattern.
Physical and Logical disk editing
This is not something added by FsPlus, rather it is a undocumented feature of Hiew32 where you can use Hiew to edit/view logical and physical disk sectors:
Conclusion
This tool has been tested with Windows Vista (32) and Windows XP SP2 and with Hiew 7.29.
Hope you find this tool useful as Hiew itself. Note: Please don’t contact me if you run into trouble. This tool is no longer supported.
Recently, I took the 6 session defensive driving course. The following are some of the notes I extracted from the course that I would like to share with my you:
There were lots of information in the course, I highly recommend taking it! You can download the notes as a single PDF file from here: (The PDF was created using the free Pic2Pdf tool)
In various programming languages, you might sometimes need to convert numbers to characters. In simple terms, each character you see has a numerical representation. The ASCII table shows the numbers of each character and its corresponding glyph.
Converting numbers to their corresponding characters would be useful to generate a random string for instance. The first step to generating a random string is to generate random numbers between 65 and 90 (upper case ‘A’ to upper case ‘Z’) or between 97 and 122 (lower case ‘a’ to lower case ‘z’).
While the Batch language is pretty primitive, you would be surprised how many things you can do with it. In the Batchography book, I cover various topics that would bring your Batch programming skills to the next level.
You have found this blog post because you are wondering if there is a way to express a “switch/case” logic in Batch files.
The short answer is: “no, not exactly”. However, there are ways to achieve the same in Batch files.
In the Batchography book, I explain in details the “switch/case” construct, but in this blog post I will illustrate this mechanism briefly. For more advanced Batch scripting topics, please grab a copy of the Batchography book.
There are so many undocumented or obscure features in the Batch scripting language and in this article I am going to illustrate how to do string substitution.
For more advanced Batch scripting topics, please grab a copy of the Batchography book.
In this technical post I am going to illustrate how you can use the simple local-web-server package for NodeJS to start your web server in a few commands.
If you are using Windows, then make sure you download the MSI package because it is so easy to install.
Keep the default options as you’re installing:
After installing NodeJS, open an elevated command prompt (i.e: run cmd.exe as Administrator) and type the following command in order to install the local-web-server package:
Since I moved to the US, I collected around 350 books. I love books and the thought of giving them up is not a pleasant thought.
Each time I used to move from an apartment to another, the majority of boxes would be packed with books. Each time I travel somewhere for a long period, I miss being able to grab a book from my bookshelf and start reading (most of my books are old and they do no exist in digital format anyway). It is clear that I have attachment to those books.
To break this attachment, I had to make a couple of decisions. The first was whether to just forget about the books, leave them on the shelves and get myself busy with another chore. The other decision was whether to scan and /or give away the books. With that came other questions like how to scan books and convert them to eBooks, what methods to use, how much efforts would it take to convert the books, etc.
I decided to get rid of the books and the trim down on the space they occupy. For the reasons outlined later in this blog post, I chose to destructively scan my books. By scanning the books, I get a digital and searchable copy of my books (in PDF format).
In chapter 4 of the Batchography book, I illustrate 3 methods that you can use to check if your Batch file script is running as an Administrator.
In this blog post, I will share with you the method entitled “Using known commands that fail to run without elevated privileges” from the book.
The idea behind this method is to run commands that are known to fail and return a non-zero error code if they are not executed with administrative privilege.
The Batch script would then check the return code and act accordingly:
@echo off
::
:: The Batchography book by Elias Bachaalany
::
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Requires administrative privilege.
goto :eof
)
echo Script starts here...
Do you want to master Batch Files programming?
Look no further, the Batchography is the right book for you.
Available in print or e-book editions from Amazon.com!
This article is compilation of the various blog posts that contain a set of steps, table of hotkeys and shortcuts and/or other quick information for reference purposes.
The list below will be updated when new relevant articles are posted in this blog:
In this blog post, I introduce a “one-click” solution to automate getting free internet at airports. This is very useful for those who don’t want to get their hands dirty!
Step 1 – Download and install
To get started, download the application from my GitHub repository here:
When you unzip the archive, you should have the following three files:
Run the “UnlimitedAirportInternet.exe” program to get started.
Step 2 – Get unlimited internet
If this was the first time you connect to the airport’s Wi-Fi, then you should have your free internet session for a while.
Each time you run out of free internet time, just press the “Give me more free internet” button.
In a previous post entitled “How to get unlimited free Internet at Airports“, I showed you how to circumvent the time limit imposed by the “free” Wi-Fi connections in certain airports.
For that trick to work, you were required to update the MAC address of your computer each time the free time is over.
In this blog post, I am going to share with you the ChangeMACAddressBatch script that I wrote with the help and instructions from the excellent Batchography book.
The script makes use of various recipes illustrated in the Batchography book (in Chapter 4) and uses the various Batch scripting language syntax (Chapters 1 and 2) and methodologies (Chapter 3). Therefore, I will not be explaining the script’s contents or how it works because it will become evident if you read the Batchography book.
Get the book from Amazon:
Paperback edition
E-book edition
How to use the script interactively
To begin with, you need to run the script with administrative privileges.
Running the script as an administrator
On Windows 8 and above, just press Win+X and choose “Command Prompt (Admin)” like this:
Otherwise, if you are using the Windows Explorer window, then right-click on your script and choose “Run as Administrator”:
Starting the script
When you first run the script, you will be presented with the main menu that will show you a list of all the adapters you have on your system.
On my laptop for instance, I have 4 adapters:
An Ethernet adapter
2 x VMWare virtual adapters
A Wi-Fi adapter
Using the keyboard, type the adapter number that you want to inspect and/or change its MAC address:
In this blog post, I am going to share with you a recipe from the Batchography book that illustrates and explains how to build a dynamic menu using the CHOICE command with Batch files. In this article, we will dynamically build a menu around the COLOR command so that the user can change the colors of the console interactively.
To learn more about this technique and the Batch scripting language, please refer to Chapters 3 and 4 in the Batchography book.
Get the book from Amazon: the print editionor the e-book edition
In this blog post, I am going to share with you a recipe from the Batchography book that illustrates and explains in details how to embed executable files in the Batch file script and execute them after they are dropped.
This technique does not rely on using a polyglot Batch file where its first part is actually a Batch script and the other part is a VBS or JScript script. If you want to learn more about how to write polyglot Batch scripts, please refer to Chapter 4 in the Batchography book.
Get the book from Amazon: the print editionor the e-book edition