create account

Rust Project: CLI Port Sniffer Tool by tensor

View this thread on: hive.blogpeakd.comecency.com
· @tensor · (edited)
$44.00
Rust Project: CLI Port Sniffer Tool
When considering what types of projects to do for the **Rust Project** tutorial series after I finished the [Intro to Rust](https://www.youtube.com/watch?v=EYqceb2AnkU&list=PLJbE2Yu2zumDF6BX6_RdPisRVHgzV02NW) series, one of the first ideas that came to my mind was a CLI tool. After going through many different Linux tools, I settled on building a **port sniffer** because it is a *multi-threaded* project and it allowed me to build the entire tool without using a single *3rd party dependency* or *library*.  Admittedly, had I used at least one third party library, the tool would have been much cleaner but that is simply because the library in question does a lot of the heavy lifting for us.  From an educational standpoint, it made more sense to build this particular tool without relying on a DSL or a *non-standard library*.

Our **CLI port sniffer** is a minimal viable product but it can easily be extended to include tons of other features should you feel the need to add them.  We use a vector of strings to collect our arguments and then create a struct to hold the data of these arguments.  We then use a method for the struct to check the arguments so that we are getting the correct patterns from the user.  After instantiating our struct's data using the method, we then create a *scalable* amount of threads based on the user input to preform the task.    Given that Rust uses **OS Threads** and not **Green threads**, your assigned threads will depend on the power of your computer and the operating system that you are using.  

*Each operating system has a maximum number of threads it assigns to a single process and a faster computer will be able to use more then a slower one.*   

The tool then iterates through all of the potential ports that could be open on the called IP and returns any ports that return a connection.  This type of tool can be useful to gain information on what ports could potentially be open on your system or router without your knowledge and also could potentially be used for malicious means (though you would would need the know how and many more tools to do so.).  This was a fun little project to make and it was deceptively difficult at times to write in a live coded session as a result of the multiple constrants that I put on myself.  

*I hope you guys enjoy this video and I hope it also helps you better understand the language of Rust. There are many more projects to come* 

**Full Github Source Code** is [here](https://github.com/tensor-programming/Rust_Port_Sniffer)

<iframe width="560" height="315" src="https://www.youtube.com/embed/-Jp7sabBCp4" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe>

*If you enjoy the video, feel free to follow me on Steemit or on YouTube to get updates on the channel as well as more content.*

*If you like what I do, tips and upvotes are welcome:*
*ETH: 0xE448a8DDA5886C49d35B191B2F20630c103024c8*
*LTC: LXsKxF5JhmMtKgqfcUFdvcXVwiaSqxN9cP*

*Also, feel free to check out my channel for videos on Go, Elixir and Elm*
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 39 others
properties (23)
authortensor
permlinkrust-project-cli-port-sniffer-tool
categorytechnology
json_metadata{"tags":["technology","steemstem","science","programming","utopian-io"],"image":["https://img.youtube.com/vi/-Jp7sabBCp4/0.jpg"],"links":["https://www.youtube.com/watch?v=EYqceb2AnkU&list=PLJbE2Yu2zumDF6BX6_RdPisRVHgzV02NW","https://github.com/tensor-programming/Rust_Port_Sniffer","https://www.youtube.com/embed/-Jp7sabBCp4"],"app":"steemit/0.1","format":"markdown"}
created2017-12-20 05:02:39
last_update2017-12-25 09:14:09
depth0
children6
last_payout2017-12-27 05:02:39
cashout_time1969-12-31 23:59:59
total_payout_value33.850 HBD
curator_payout_value10.149 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,051
author_reputation87,856,203,149,624
root_title"Rust Project: CLI Port Sniffer Tool"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id24,295,364
net_rshares6,968,858,344,905
author_curate_reward""
vote details (103)
@five34a4b ·
rust-project-cli-port-sniffer-tool-comment
you're making steemit a great community with your content tensor! keep it up!
properties (22)
authorfive34a4b
permlinkrust-project-cli-port-sniffer-tool-comment
categorytechnology
json_metadata{}
created2017-12-20 21:42:03
last_update2017-12-20 21:42:03
depth1
children1
last_payout2017-12-27 21:42:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length77
author_reputation1,119,681,610,239
root_title"Rust Project: CLI Port Sniffer Tool"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id24,417,556
net_rshares0
@tensor ·
Thank you that means a lot to me.  I try to make the content as engaging as possible.  I've got another video coming out tonight and then it the amount of content will probably start to slow down as I start to look at larger projects.
properties (22)
authortensor
permlinkre-five34a4b-rust-project-cli-port-sniffer-tool-comment-20171220t222720339z
categorytechnology
json_metadata{"tags":["technology"],"app":"steemit/0.1"}
created2017-12-20 22:27:18
last_update2017-12-20 22:27:18
depth2
children0
last_payout2017-12-27 22:27:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length234
author_reputation87,856,203,149,624
root_title"Rust Project: CLI Port Sniffer Tool"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id24,422,926
net_rshares0
@qurator ·
Quratorcomment
<center>Qurator</center> | <center>Your Quality Content Curator</center>
-|-|
![](https://steemitimages.com/DQmNzJZFNXnViq9Ebmccf3rLi7kiYrcHFnFqeKK7QnWYtRs/COMMENT.png) | This post has been upvoted and given the stamp of authenticity by @qurator. To join the quality content creators and receive daily upvotes click [here](https://steemit.com/qurator/@qurator/qurator-update-3-some-guidelines-and-tier-related-changes) for more info. 
<center>*Qurator's exclusive support bot is now live. For more info click [HERE](https://steemit.com/qurator/@qurator/qurator-support-bot-alive-and-active-welcome-to-qustodian) or send some SBD and your link to @qustodian to get even more support.*</center>
properties (22)
authorqurator
permlinkre-tensor-rust-project-cli-port-sniffer-tool-20171220t052339228z
categorytechnology
json_metadata""
created2017-12-20 05:23:57
last_update2017-12-20 05:23:57
depth1
children0
last_payout2017-12-27 05:23:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length692
author_reputation1,646,561,306,958,033
root_title"Rust Project: CLI Port Sniffer Tool"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id24,297,416
net_rshares0
@steemstem ·
<center>![](https://s18.postimg.org/kazxz8qsp/steem_up.jpg)</center>
properties (22)
authorsteemstem
permlinkre-tensor-rust-project-cli-port-sniffer-tool-20171220t072338833z
categorytechnology
json_metadata{"tags":["technology"],"image":["https://s18.postimg.org/kazxz8qsp/steem_up.jpg"],"app":"steemit/0.1"}
created2017-12-20 07:23:42
last_update2017-12-20 07:23:42
depth1
children0
last_payout2017-12-27 07:23:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length68
author_reputation262,017,435,115,313
root_title"Rust Project: CLI Port Sniffer Tool"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id24,309,615
net_rshares0
@tensor ·
@originalworks
properties (22)
authortensor
permlinkre-tensor-rust-project-cli-port-sniffer-tool-20171220t050714878z
categorytechnology
json_metadata{"tags":["technology"],"users":["originalworks"],"app":"steemit/0.1"}
created2017-12-20 05:07:15
last_update2017-12-20 05:07:15
depth1
children1
last_payout2017-12-27 05:07:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length14
author_reputation87,856,203,149,624
root_title"Rust Project: CLI Port Sniffer Tool"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id24,295,781
net_rshares0
@originalworks ·
originalworks
The @OriginalWorks bot has determined this post by @tensor to be original material and upvoted it! 
<center>![ezgif.com-resize.gif](https://steemitimages.com/DQmaBi37A5oTnQ9NBLH8YU4jpvhhmFauyvgg3YRrEJwskM9/ezgif.com-resize.gif)</center> 

To call @OriginalWorks, simply reply to any post with @originalworks or !originalworks in your message!
properties (22)
authororiginalworks
permlinkre-re-tensor-rust-project-cli-port-sniffer-tool-20171220t050714878z-20171220t050832
categorytechnology
json_metadata"{"app": "pysteem/0.5.4"}"
created2017-12-20 05:08:33
last_update2017-12-20 05:08:33
depth2
children0
last_payout2017-12-27 05:08:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length342
author_reputation79,292,026,602,057
root_title"Rust Project: CLI Port Sniffer Tool"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id24,295,901
net_rshares0