bytedeez Posted December 28, 2014 Share Posted December 28, 2014 I was wanting to make a few commands (lets say the command is : msfconsole) into a gui icon for faster execution in my ubuntu vm. I was wondering if there is a tool to do this? I tried making a .desktop file but failed plus i want the icon on my launcher, not my desktop. Quote Link to comment Share on other sites More sharing options...
cooper Posted December 28, 2014 Share Posted December 28, 2014 Define 'desktop'. Specifically, the VM and the launcher. Quote Link to comment Share on other sites More sharing options...
bytedeez Posted December 28, 2014 Author Share Posted December 28, 2014 well by desktop i mean the main workspace. By launcher i mean the default panel in ubuntu. Or a dock for that matter. Quote Link to comment Share on other sites More sharing options...
cooper Posted December 28, 2014 Share Posted December 28, 2014 Did I really say VM? I really said VM. GAH! That's what abbreviations will do to you. WM. Window manager. I don't have a clue what Ubuntu comes with standard and I also don't have a clue what program, as it's bound to be a separate one, that WM uses for docking its apps. Quote Link to comment Share on other sites More sharing options...
bytedeez Posted December 29, 2014 Author Share Posted December 29, 2014 lol, It uses unity, but i am using this gtk theme called hackstation, but i don't believe that matters. Quote Link to comment Share on other sites More sharing options...
cooper Posted December 29, 2014 Share Posted December 29, 2014 Like this? Quote Link to comment Share on other sites More sharing options...
bytedeez Posted December 31, 2014 Author Share Posted December 31, 2014 (edited) That might work i will test it. Just from reading it i think this only working if the program already has a icon / can be called from the launcher search menu. But i will test and let you know, either way Excellent Find! I can use the program for other needs as well! Thanks Cooper! Edited December 31, 2014 by bytedeez Quote Link to comment Share on other sites More sharing options...
bytedeez Posted January 2, 2015 Author Share Posted January 2, 2015 (edited) In general yes that tool will work, but the downside to it is a proper Icon can not set. Still nice find! EDIT: Scratch that! figured out you can set the icon after all. Thanks! EDIT # 2: After setting Icon i tested the new created gui-icon. Unfortunately it did not work, from a google search it seems to be a common problem with the tool, Because i read in one post that indicator had to be installed for it to work properly, i installed it but had the same result. Edited January 2, 2015 by bytedeez Quote Link to comment Share on other sites More sharing options...
Sebkinne Posted January 2, 2015 Share Posted January 2, 2015 What you want to do is create a new .desktop file in /usr/share/applications/ touch /usr/share/applications/msfconsole.desktop Then, you should paste the following in the above file, making sure to change your path. [Desktop Entry] Name=msfconsole Comment=Metasploit msfconsole Exec=/path/to/msfconsole Icon=/path/to/icon.png Terminal=true Type=Application Categories=Utility;Application; That should do the trick. You should be able to use the new shortcut once you relog / reboot. Best Regards, Sebkinne Quote Link to comment Share on other sites More sharing options...
bytedeez Posted January 3, 2015 Author Share Posted January 3, 2015 (edited) Thanks Seb! I tried creating a .desktop file when i first started attempting to do this, but i gave it another go. but.. Its seems i am still having trouble. here is my file in: /usr/share/applications [Desktop Entry] Name=msfconsole Comment=Metasploit msfconsole Exec=/usr/local/share/metasploit-framework/msfconsole.rb Icon=/home/<username>/msf_icon.png Terminal=true Type=Application Categories=Utility;Application; Everything seems like it should run fine until i try to run the program, then it says an error has occured when trying to launch application. I was thinking maybe it was my msfconsole file that was wrong but from what i am looking at it is right. Here is the msfconsole file: #!/usr/bin/env ruby # -*- coding: binary -*- # # This user interface provides users with a command console interface to the # framework. # # # Standard Library # require 'pathname' if ENV['METASPLOIT_FRAMEWORK_PROFILE'] == 'true' gem 'perftools.rb' require 'perftools' formatted_time = Time.now.strftime('%Y%m%d%H%M%S') root = Pathname.new(__FILE__).parent profile_pathname = root.join('tmp', 'profiles', 'msfconsole', formatted_time) profile_pathname.parent.mkpath PerfTools::CpuProfiler.start(profile_pathname.to_path) at_exit { PerfTools::CpuProfiler.stop puts "Generating pdf" pdf_path = "#{profile_pathname}.pdf" if Bundler.clean_system("pprof.rb --pdf #{profile_pathname} > #{pdf_path}") puts "PDF saved to #{pdf_path}" Rex::Compat.open_file(pdf_path) end } end # # Project # # @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/generators/rails/app/templates/script/rails#L3-L5 require Pathname.new(__FILE__).realpath.expand_path.parent.join('config', 'boot') require 'metasploit/framework/command/console' Metasploit::Framework::Command::Console.start I also tried creating the file while being logged in as root but had similar results. I also tried making the file "executable" but didn't get any further that way wither. Edited January 3, 2015 by bytedeez Quote Link to comment Share on other sites More sharing options...
cooper Posted January 3, 2015 Share Posted January 3, 2015 If you place a regular shell script next to the .rb file which does nothing more than feed the .rb into the ruby interpreter and have that run by the icon, does that work? Maybe the're using a (more) restrictive means of running the program. If anything, you can add some echo lines to the script and feed the output of the .rb program into a logfile of sorts from the .sh file to see what's up. Quote Link to comment Share on other sites More sharing options...
bytedeez Posted January 3, 2015 Author Share Posted January 3, 2015 (edited) Thats out of my league Cooper. LOL I know very basic programming in python and Java. And the basics as to how code is written I.E. methods, variables, functions and so on but that is it. Although I've edited scripts, i have never written one from a blank canvas. If i could write one i was thinking that maybe i needed a few lines that started services and then called the console. I see in the code above at the end it has this line require 'metasploit/framework/command/console' Wouldn't this call it as well, if i wrote a script that started services and then called that^^^ or is that the same as msfconsole?....(don't laugh, as i know i'm probably talking out my ass) Edit: right now i'm just using armitage, but i have a few other programs that are command only that i'm trying to assign an icon to.....I honestly i didn't think it would be difficult to accomplish when i first started looking into creating a gui icon. Edited January 3, 2015 by bytedeez Quote Link to comment Share on other sites More sharing options...
cooper Posted January 3, 2015 Share Posted January 3, 2015 (edited) As root, create a file named /usr/local/share/metasploit-framework/msfconsole.sh and make it executable. Edit it so it reads #!/bin/bash ruby /usr/local/share/metasploit-framework/msfconsole.rb > /var/log/msfconsole.log Have your icon execute the .sh file instead of the .rb and if it works, just remove the "> /var/log/msfconsole.log" bit from the script. If it doesn't work, see what gets written to that log file for clues. Edit: Looking at what's being run and how it's running it, check out that first line in the .rb script: #!/usr/bin/env ruby That runs 'ruby'. The env bit allows messing with the environment variables - ignore for now. The point is that it's running _just_ 'ruby' as opposed to /path/to/ruby which you normally see. On most shells this is probably not a problem but on more restrictive shells your local environment-setting script (i.e. .bashrc) doesn't get run so the path within which the ruby binary resides doesn't get added to the path before the script runs and the outcome is an error because it can't find the interpreter needed. I'm fairly confident this is the problem you're having. Edited January 3, 2015 by Cooper Quote Link to comment Share on other sites More sharing options...
bytedeez Posted January 5, 2015 Author Share Posted January 5, 2015 (edited) hmmmm... created the .sh file. touch /usr/local/share/metasploit-framework/msfconsole.sh copy and pasted the code above into it then.. chmod +x msfconsole.sh Then i edited the .Desktop file [Desktop Entry] Name=msfconsole Comment=Metasploit msfconsole Exec=/usr/local/share/metasploit-framework/msfconsole.sh Icon=/home/<username>/Downloads/msf_icon.png Terminal=true Type=Application Categories=Utility;Application; Then i migrated to the applications folder and tried opening the application, it opened a terminal but immediately closed. I checked the log file but nothing was there. I then decided to execute the script as normal. ./msfconsle.sh then i received this error in the terminal: /usr/local/share/metasploit-framework# ./msfconsole.sh ruby: No such file or directory -- /usr/local/share/metasploit-framework/msfconsole.rb (LoadError) So again i checked the log file, it remained empty. The part that confuses me about the above error is the "no such file or directory". When it obviously there. lol EDIT: ok so i started going back through all the steps to make sure all the links were correct. The only thing i noticed was that even though msfconsole was a ruby file. I could not find any link or file that represented it with the file extension .rb, so i remove the .rb from the script and...drum roll please..... BAM!! It worked like a charm. I tried removing the script and creating the original .desktop file as described by Seb but did not work. Therefore you were correct Master Cooper! Edited January 6, 2015 by bytedeez Quote Link to comment Share on other sites More sharing options...
bytedeez Posted January 6, 2015 Author Share Posted January 6, 2015 (edited) After further testing, it seems that once i launched the application it stalls at starting "Starting Metaspliot Framework.../". The Log file seems to contain the next step in msfconsole: [0m[36m[0m[37m Metasploit Park, System Security Interface Version 4.0.5, Alpha E Ready... > [1maccess security[0m access: PERMISSION DENIED. > [1maccess security grid[0m access: PERMISSION DENIED. > [1maccess main security grid[0m access: PERMISSION DENIED....and... [31mYOU DIDN'T SAY THE MAGIC WORD! YOU DIDN'T SAY THE MAGIC WORD! YOU DIDN'T SAY THE MAGIC WORD! YOU DIDN'T SAY THE MAGIC WORD! YOU DIDN'T SAY THE MAGIC WORD! YOU DIDN'T SAY THE MAGIC WORD! YOU DIDN'T SAY THE MAGIC WORD![0m [0m =[ [33mmetasploit v4.11.0-dev [core:4.11.0.pre.dev api:1.0.0][0m] + -- --=[ 1382 exploits - 777 auxiliary - 223 post ] + -- --=[ 356 payloads - 37 encoders - 8 nops ] + -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ] [4mmsf[0m [0m> Checked it serveral times and each time it contains one of the variants of msfconsole. Aha removed "> /var/log/msfconsole.log" from the script, Sense it seemed to be throwing my session into the log file. Got on here to report that everything is working good, then noticed you said to remove it above..LOL! Edited January 7, 2015 by bytedeez Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.