Results 1 to 5 of 5

Thread: [SOLVED] custom BT4 beta - major problem with Gnome

  1. #1
    Senior Member orange's Avatar
    Join Date
    Jan 2010
    Posts
    134

    Default [SOLVED] custom BT4 beta - major problem with Gnome

    Backtrack Community,

    this is my very first post here and I'm sorry for opening a new topic, but although I found many Gnome topics, nothing really matches the issues I have to face currently. I'm trying to build a custom iso of BT4 beta, i.e. replacing KDE with Gnome and I've achieved a lot already (network works, I have managed to introduce a "Backtrack" folder to the Gnome Menu as in KDE, I managed to completely get rid of KDE and installed a very basic gnome-core I build upon, etc etc - all in all it's pretty much complete from a DE perspective) but now I ran into a MAJOR problem and I'd like to ask for suggestions from the community how to solve it.

    Ok, here it is:
    Backtrack introduces a whole bunch of launchers to the menu (desktop files) that are located in /usr/local/share/applications. As I said before, I managed to make them available in Gnome just as in KDE with all categories and stuff, BUT not a single launcher works with gnome-terminal unfortunately (at least not many). I already found out why this is - it's the way konsole handles bash calls and this is significantly different to the way gnome-terminal does it. That's at least the result of my investigation (please correct me if I'm wrong)

    Two problem categories:

    1. If a certain desktop file (e.g. the airmon-ng one) includes an exec= line and no path= line, it's easy to substitute "airmon-ng;sudo -s" with "gnome-terminal -x bash -c "airmon-ng; sudo -s" and the launcher works.
    2. If the desktop file includes both an exec= line, e.g. "command;sudo -s" and a path= line, e.g. path=/somepath, it's also easy to substitute with "gnome-terminal -x bash -c "cd /somepath; command;sudo -s"
    I mean the intention of path= is that the launched konsole/gnome-terminal should open at /somepath, right?

    So far, so good - you could think: what's the actual problem man? The problem is that I'd like to do it the "right" way and avoid "hacking" existing config files to make it run just due to the fact that the Backtrack team could release an update to e.g. aircrack-ng at some point in time that would override the "hacked" desktop file and we'd be in a deadlock again. I hope it's clear to you what the actual issue is. Besides of that it's anyway pretty annoying to change approx. 200 launchers just to make them usable in gnome-terminal. Next thing I thought about is writing kind of a wrapper "gnome-terminal" and use dpkg-divert to set the "real" gnome-terminal apart. That way one would achieve an "ultimate solution" for all desktop files in question. BUT, that introduces some other issues to gnome-terminal's general usage AND to be honest I fear that I'm not experienced enough to write such an "ultimate wrapper".

    So, what I'd like to know: Is there someone running a Gnome desktop and have similar issues and a solution maybe? Could someone more experienced help me a bit with a wrapper? What do you think about this idea in general? Do you maybe have any much more brilliant ideas how to solve this? I'm open for any suggestions and comments.

    Thanks a million in advance,
    orange

  2. #2
    Developer muts's Avatar
    Join Date
    Jan 2006
    Posts
    272

    Default Will be easier

    It will be MUCH easier for you to work with the Base development tools we have.
    I suspect that creating a bt4 iso based on gnome would be relatively easy using our build process, sans the BT menu.
    Please contact me via IRC (irc.freenode.net #remote-exploit ) if you're interested in working on this together.

  3. #3
    Senior Member orange's Avatar
    Join Date
    Jan 2010
    Posts
    134

    Default

    Quote Originally Posted by muts View Post
    It will be MUCH easier for you to work with the Base development tools we have.
    I suspect that creating a bt4 iso based on gnome would be relatively easy using our build process, sans the BT menu.
    Please contact me via IRC (irc.freenode.net #remote-exploit ) if you're interested in working on this together.
    muts,

    thanks a lot for your quick reply and especially your offer in working together on this. I'm certainly interested to do so and would appreciate any information about your Base development tools (especially IF that would also solve the issues with gnome-terminal - not sure how yet, but I'm pretty sure YOU know).

    That said and prior talking about it at #remote-exploit (it's already pretty late here - CEST time), I'd like to give some more insight in what I try to achieve actually. I thought about starting a community-maintained BT4 Gnome edition IF it turns out that all works as desired (i.e. I'd be able to manage all this). Afaik there are many people (besides me) out there that would appreciate the availability of such a custom iso image. That said I'm anyway waiting for the public release of BT4 final to be able to get started with the casper live cd system - I mean the current linux-live-scripts in BT4 beta will be anyway obsolete in the near future (afaik at least from the Offensive-Securirty announcements you did recently).

    As of the BT menu, I guess integrating it into a Gnome Environment shouldn't be that difficult assumed that I understand your "Customizing the BT4 pre-final" blogpost at Offensive-Security correctly. I mean all I did is basically taking your /root/.config/menus/applications-kmenuedit.menu and build a applications.menu suitable for Gnome out of it - Gnome utilizes (in contrast to KDE) a "merge approach" regarding menus. So, all we'd need to do is placing my custom applications.menu in /root/.config/menus/ and it'll merge with the existing menu structure. We could even do this systemwide for every new created user by introducing the custom applications.menu into /etc/skel - still on the same page here?

    I'll try to login in the evenings to #remote-exploit (the next days - CEST time) and if you happen to be available as well, I'd really like to talk about working together here. Is CEST time suitable for you in general? I mean, I have no clue where you're located actually. What do you think in general about my actual plan of starting a community-maintained BT4 Gnome edition? My ultimate goal here is to achieve as minimal customization as possible to the standard Backtrack (as outlined in my post above) to ensure maximal compatibility with e.g. the Backtrack online repositories.

    thanks for your time,
    orange

  4. #4
    Developer muts's Avatar
    Join Date
    Jan 2006
    Posts
    272

    Default

    Really looking forward to this.

  5. #5
    Senior Member orange's Avatar
    Join Date
    Jan 2010
    Posts
    134

    Default

    @muts
    Unfortunately, I haven't managed to contact you via IRC (yet)

    @All
    Although this is WIP, I'd like to share my current state of .desktop conversation. I've written an awk-script and a shell-script that modifies the .desktop files in /usr/local/share/applications/ to get them working with gnome-terminal. I need to consider some excludes (e.g. SAINT) tough - this isn't done yet.

    test3.awk looks like this
    Code:
    #!/usr/bin/awk -f
    BEGIN{FS="="}
    $1=="Exec" {exec = $2;en=NR}
    $1=="Path" {path = $2}
    {array[NR]=$0}
    END{
    if (exec~/cd / || path == ""){
        exec="gnome-terminal -x bash -c ""\""exec"\"";
    } else {
        exec="gnome-terminal -x bash -c ""\"""cd "path";"exec"\"";
    }
    array[en]="Exec=" exec
    for(i=1;i<=NR;i++){
      print array[i]
    }
    }
    test3.sh like this
    Code:
    #!/bin/sh
    for i in /usr/local/share/applications/*.desktop; do
    cp "$i" "$i.orig"; ./test3.awk "$i" > "$i.tmp"; mv "$i.tmp" "$i"; 
    done
    Any input from "coding gurus" is certainly appreciated and besides general documentation purposes the reason I post this.

    EDIT 06-09-2009
    Just for the record: here's today's outcome, i.e. another step forward to a KDE/Gnome cross-desktop compatible solution. I'll explain this in detail another time - it's pretty late already. I thought about posting it though as it's from my perspective way better than yesterday's solution and thus should be documented - in case anyone wants to try it.

    test4.sh
    Code:
    #!/bin/sh
    for i in /usr/local/share/applications/*.desktop; do
    cp "$i" "$i.orig"; ./test4.awk "$i" > "$i.tmp"; mv "$i.tmp" "$i"; 
    done
    test4.awk
    Code:
    #!/usr/bin/awk -f
    BEGIN{FS="="}
    $1=="Exec" {exec = $2;en=NR}
    {array[NR]=$0}
    END{
    split(exec, esplit, ";")
    if(esplit[2] > ""){
        exec="sh -c ""\""exec"\""
    }
    array[en]="Exec=" exec
    for(i=1;i<=NR;i++){
      print array[i]
    }
    }
    EDIT 06-10-2009
    One more revision to the awk script - this one also considers " as a restricted character in the Exec key and takes care of escaping it - just a minor change to yesterday's version though
    Code:
    #!/usr/bin/awk -f
    BEGIN{FS="="}
    $1=="Exec" {exec = $2;en=NR}
    {array[NR]=$0}
    END{
    gsub(/\"/,"\\\"",exec)
    split(exec, esplit, ";")
    if(esplit[2] > ""){
           exec="sh -c ""\""exec"\""
    }
    array[en]="Exec=" exec
    for(i=1;i<=NR;i++){
      print array[i]
    }
    }
    EDIT 06-11-2009
    No need for head banging anymore - the issue is finally solved and the solution is documented here

    best,
    orange

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •