Audio Playback in AwesomeWM

As a Window Manager, awesome-wm‘s lightweight composition
results in a more-responsive user experience as compared to a full-fledged Desktop Environment like
Gnome, for example. However, depending on your needs, lightweight might also be described
as stripped down; your expectations of what simply “works” (or should work) right out
the gate in a graphical desktop session, without any user input, may be misguided, as I found mine
to be today after attempting to watch a YouTube video with no apparent sound.

Puzzled by the strange
effect, I clicked on another, different, random video, restarted my browser, cleared the cache, tested
the audio output with VLC media player to ascertain the persistence of the problem. It seemed
inconceivable to me that I hadn’t noticed this behavior before, especially, because I had been using awesome-wm for years it seemed! Alas, ’twas so afterall.

Here’s how I managed to
fix the problem with Audio playback on my Fedora20 system.


First, make sure that your user is in the audio, pulse, and pulse-access
groups; if not, execute the following as root

    # usermod -a -G audio myusername
    # usermod -a -G pulse myusername
    # usermod -a -G pulse-access myusername

Then, edit ~/.xinitrc, if you’re starting awesome-wm from console, and add the following line:

    start-pulseaudio-X11
 

Kill the pulseaudio process, log out and log in again–I ended up simply rebooting the system, instead.

As a hidden Easter Egg, for those who made it to the end of this post, take a look at Farhavens volume widget over on the
awesome-wm wiki pages .

NOTE: `start-pulseaudio-X11` is, actually, a script in the `/bin/` directory.
Advertisements

Binary Code Analysis Tools

Linux tools

GDB

GNU Debugger (GDB) is not only good to debug buggy applications . It can also be used to learn about a program’s control flow, change a program’s control flow, and modify the code, registers, and data structures. These tasks are common for a hacker who is working to exploit a software vulnerability or is unraveling the inner workings of a sophisticated virus. GDB works on ELF binaries and Linux processes. It is an essential tool for Linux hackers.

Objdump from GNU binutils

Object dump (objdump) is a simple and clean solution for a quick disassembly of code. It is great for disassembling simple and untampered binaries, but will show its limitations quickly when attempting to use it for any real challenging reverse engineering tasks, especially against hostile software. Its primary weakness is that it relies on the ELF section headers and doesn’t perform control flow analysis, which are both limitations that greatly reduce its robustness. This results in not being able to correctly disassemble the code within a binary, or even open the binary at all if there are no section headers. For many conventional tasks, however, it should suffice, such as when disassembling common binaries that are not fortified, stripped, or obfuscated in any way. It can read all common ELF types. Here are some common examples of how to use objdump:

View all data/code in every section of an ELF file:

objdump -D OBJECT

View only program code in an ELF file:

objdump -d OBJECT

View all symbols:

objdump -tT OBJECT

Objcopy from GNU binutils

Object copy (Objcopy) is an incredibly powerful little tool that we cannot summarize with a simple synopsis. I recommend that you read the manual pages for a complete description. Objcopy can be used to analyze and modify ELF objects of any kind, although some of its features are specific to certain types of ELF objects. Objcopy is often times used to modify or copy an ELF section to or from an ELF binary.

To copy the .data section from an ELF object to a file, use this line:

objcopy –only-section=.data INFILE OUTFILE

strace

System call trace (strace) is a tool that is based on the ptrace(2) system call, and it utilizes the PTRACE_SYSCALL request in a loop to show information about the system call (also known as syscalls) activity in a running program as well as signals that are caught during execution. This program can be highly useful for debugging, or just to collect information about what syscalls are being called during runtime.

This is the strace command used to trace a basic program, writing the output to a file “ls.out”:

strace /bin/ls -o ls.out

The strace command used to attach to an existing process is as follows:

strace -p PID -o daemon.out

The initial output will show you the file descriptor number of each system call that takes a file descriptor as an argument, such as this:

SYS_read(3, buf, sizeof(buf));

If you want to see all of the data that was being read into file descriptor 3, you can run the following command:

strace -e read=3 /bin/ls

You may also use -e write=fd to see written data. The strace tool is a great little tool, and you will undoubtedly find many reasons to use it.

ltrace

library trace (ltrace) is another neat little tool, and it is very similar to strace. It works similarly, but it actually parses the shared library-linking information of a program and prints the library functions being used.

Basic ltrace command

You may see system calls in addition to library function calls with the -S flag. The ltrace command is designed to give more granular information, since it parses the dynamic segment of the executable and prints actual symbols/functions from shared and static libraries:

ltrace PROGRAM -o program.out

ftrace

Function trace (ftrace) is similar to ltrace, but it also shows calls to functions within the binary itself. This tool can be found on GitHub.

readelf

The readelf command is one of the most useful tools around for dissecting ELF binaries. It provides every bit of the data specific to ELF necessary for gathering information about an object before reverse engineering it. This tool will be used often throughout the book to gather information about symbols, segments, sections, relocation entries, dynamic linking of data, and more. The readelf command is the Swiss Army knife of ELF. The ELF Binary Format’s  most commonly used flags:

To retrieve a section header table:

readelf -S OBJECT

To retrieve a symbol table:

readelf -s OBJECT

To retrieve the ELF file header data:

readelf -e OBJECT

To retrieve relocation entries:

readelf -r OBJECT

To retrieve a dynamic segment:

readelf -d OBJECT

ERESI – The ELF Reverse Engineering System Interface

ERESI project (http://www.eresi-project.org) contains a suite of many tools that are a Linux binary hacker’s dream. Unfortunately, many of them are not kept up to date and aren’t fully compatible with 64-bit Linux. They do exist for a variety of architectures, however, and are undoubtedly the most innovative single collection of tools for the purpose of hacking ELF binaries that exist today. There are two Phrack articles that demonstrate the innovation and powerful features of the ERESI tools:

Cerberus ELF interface (http://www.phrack.org/archives/issues/61/8.txt)

Embedded ELF debugging (http://www.phrack.org/archives/issues/63/9.txt)

The ERESI project has moved from eresi-project.org to GitHub

https://www.packtpub.com/big-data-and-business-intelligence/learning-linux-binary-analysis

CentOS7 and PHP7

I don’t think this is specific to CentOS only.  Nevertheless, on my system with CentOS7 with PHP 7 installed as the default php version,  the web page was not displaying; rather, the php page was offered to be downloaded:

Screenshot with PHP7 Fail

The following line had to be changed in “.htaccess” file:

BAD:  AddType application/x-httpd-php .php .php7 .phtml

GOOD:  AddType application/x-httpd-php7 .php7

 

 


AddType application/x-httpd-php7 .php7
#  AddType application/x-httpd-php7 .php .php7 .phtml

#    php -- END    cPanel-generated handler,    do    not edit

#  BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule    . /index.php [L]

Firefox Customizations

Auto-hide Bookmarks Toolbar

~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css

Block certain parts of a domain

~/.mozilla/firefox/<profile_dir>/chrome/userContent.css
@-moz-document domain(example.com) {
    div#header {
      background-image: none !important;
    }    
}

 

 

awesome Window Manager on CentOS7

Awesome Window Manager is a tiling manager written in lua.  Unfortunately, it’s not available on Enterprise Linux.  The closest one can get is to install a Fedora19 repository and get it from there.

This post is meant to document the procedure involved in my attempt to create a RHEL7 and/or CentOS7 “native” version of the awesome-wm.rpm package.

I intend to upload it to Fedora’s copr users repositories and then make it available to Software Collections.

 

MORE TO COME…