1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

My first public tool

Discussion in 'General Linux Discussion' started by Daerandin, May 23, 2016.

  1. Daerandin

    Daerandin Active Member

    Joined:
    Oct 18, 2013
    Messages:
    964
    Likes Received:
    155
    Trophy Points:
    43
    Location:
    Northern Norway
    Home page:
    I have made a very simple battery monitor for myself. I don't use a desktop environment, nor did I wish to install some power management program which would pull in lots of dependencies. So I wrote a little tool in C which, along with a systemd service file, runs at boot and monitors my laptop battery.

    https://github.com/Daerandin/sbatterymonitor

    Probably not the most useful tool for the rest of the Linux ecosystem, but I wanted to start small. Perhaps in time I'll have ideas that might be more useful for others. In any case, it's there for anyone interested in having a look.
    Aryvandaar and booman like this.
  2. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    7,709
    Likes Received:
    550
    Trophy Points:
    113
    Location:
    Linux, Arizona
    Home page:
    Very nice, thank you for contributing to Linux!
  3. cloasters

    cloasters Well-Known Member

    Joined:
    Jul 3, 2013
    Messages:
    4,239
    Likes Received:
    55
    Trophy Points:
    48
    Excellent, thank you very much Daerandin!
  4. Daniel~

    Daniel~ Chief BBS Administrator Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    7,994
    Likes Received:
    121
    Trophy Points:
    63
    Location:
    Greenwater WA
    Home page:
    I have no doubt that many more such projects lie a head for you. Thank you for sharing your journey!

    This is the way Linux prospers! ":O}
  5. Daerandin

    Daerandin Active Member

    Joined:
    Oct 18, 2013
    Messages:
    964
    Likes Received:
    155
    Trophy Points:
    43
    Location:
    Northern Norway
    Home page:
    Thanks for all the support guys! Like I said, this is something that very few people would find useful. If you use a regular desktop environment (like most people do), then you already have similar functionality built-in.

    I actually did have one idea recently which I might put into reality. I have a VPN subscription, and I sometimes want to be able to switch between several of the available VPN nodes that are available to my subscription. I already have a simple bash script which enables me to toggle VPN on and off. The script also lets me choose a node on start, as well as switching DNS server. I might write this in C and add some more functionality to it. A graphical interface could also be an option for such a program.
  6. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    7,709
    Likes Received:
    550
    Trophy Points:
    113
    Location:
    Linux, Arizona
    Home page:
    Yes, you have sent the VPN code to me before.
    This is a great feature for people in other countries.

    Have you found any programs like it online?
  7. Daerandin

    Daerandin Active Member

    Joined:
    Oct 18, 2013
    Messages:
    964
    Likes Received:
    155
    Trophy Points:
    43
    Location:
    Northern Norway
    Home page:
    The little script I have now will only work on a distribution with systemd, and it also only works with my specific profiles.

    As OpenVPN is based on using profiles, I doubt there is any existing program for the purpose of toggling profiles. However, I think some graphical interfaces for network managers might have some kind of feature like this built-in. I don't know for sure since I don't use graphical interfaces to network setup.

    I think I'll get started on this during the coming weekend. I can probably make it work with different init systems, so that it can start OpenVPN on different distributions. This would just require a launch option, or perhaps a setting in a config file.
  8. Daniel~

    Daniel~ Chief BBS Administrator Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    7,994
    Likes Received:
    121
    Trophy Points:
    63
    Location:
    Greenwater WA
    Home page:
    I can see the wheels are already spinning! LOL
  9. cloasters

    cloasters Well-Known Member

    Joined:
    Jul 3, 2013
    Messages:
    4,239
    Likes Received:
    55
    Trophy Points:
    48
    As the saying used to go, Daerandin you are da man!
  10. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    7,709
    Likes Received:
    550
    Trophy Points:
    113
    Location:
    Linux, Arizona
    Home page:
    Mint network connections can configure a VPN
    Would this do something similar for you?
    mintvpn01.png

    mintvpn02.png

    Advanced Settings
    mintvpn03.png
  11. Daerandin

    Daerandin Active Member

    Joined:
    Oct 18, 2013
    Messages:
    964
    Likes Received:
    155
    Trophy Points:
    43
    Location:
    Northern Norway
    Home page:
    Configuring a vpn is not the issue here. Pretty much all vpn providers provide openvpn profiles for their servers. You just need to run a single command to start the vpn connection.

    Since I have access to multiple nodes around the world, I wrote my own script to easily switch between the different server profiles I have, while at the same time ensuring that I also switch the DNS servers provided by the vpn company. If you don't change DNS servers, then you are leaking your original location through DNS requests.

    Keep in mind that for many people, using a vpn is a matter of principle. In my country, it is fully legal for certain organizations to ask my ISP for their logged internet traffic related to my IP address. All that is required is the suspicion of copyright infringement, and I can be legally monitored. This is true for a lot of countries, and there are even some countries where ISP's will limit certain ports. I recall having read that many US ISP's limit specific ports by slowing down the transfer speed. If you use a VPN, all your traffic is encrypted to the VPN server, and you ISP have no way to determine what kind of data is being transmitted. The only thing visible to your ISP is the IP of the vpn server you are connected to.

    How much far this privacy goes is of course dependent on the reliability of the vpn provider. The one I am using has received warm reviews, and there have been cases which has proven that they keep no logs on their servers.

    So my goal is just to be able to quickly and easily switch between pofiles, or switch off my vpn and go back to my regular DNS servers. As I said, I already have that with my script, but I would like to create a more general approach. I have no idea if other people would find this useful, but it would be very educational for me to create this. I would probably go for a command line interface first, and then I might create a graphical interface to the program once the basic functionality is done.

    And even if a similar kind of functionality is present in the graphical interfaces available to most desktop environments, I have no interest in using it. I only use command line tools for my network, netctl with automatic selection of preconfigured profiles.
  12. Lorena

    Lorena Member

    Joined:
    May 11, 2016
    Messages:
    142
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Buenos Aires - Argentina
    Keep up the great work Draedin - You rock man!
  13. Daniel~

    Daniel~ Chief BBS Administrator Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    7,994
    Likes Received:
    121
    Trophy Points:
    63
    Location:
    Greenwater WA
    Home page:
    I think I'm following the basic idea, is this strictly for your own exploration and entertainment or does a need propel your efforts...

    Like I said, I only think I'm following, so go easy on me if this is self evident to all but me.":O}
  14. Daerandin

    Daerandin Active Member

    Joined:
    Oct 18, 2013
    Messages:
    964
    Likes Received:
    155
    Trophy Points:
    43
    Location:
    Northern Norway
    Home page:
    To be honest, my primary goal here is self-education. It is easy to create what I need with a simple script, which I already have. But I'd like to challenge myself a little. I know C, I love C, but I have not really made any C programs outside of whatever I create while learning or for my own very specialized use cases.

    So creating tools that are a little more general, that people can use on different systems, is a good educational experience for me. Making all the code public also opens up for criticism from others who knows C much better than me.

    Which brings up another point. If anyone have any idea for some kind of program they would like to see, or some kind of task they would like to see automated on their computer, feel free to mention it. I can't promise that I can do anything about it, but I will always look into it. If it is something that could be accomplished in a few weeks or less, chances are good that I'll do it.

    When it comes to my personal vpn usage, that is solely principle. I am a firm believer in the right to privacy.
  15. cloasters

    cloasters Well-Known Member

    Joined:
    Jul 3, 2013
    Messages:
    4,239
    Likes Received:
    55
    Trophy Points:
    48
    What a great attitude, most excellent, Daerandin!
  16. Gizmo

    Gizmo Chief Site Administrator Staff Member

    Joined:
    Dec 6, 2012
    Messages:
    2,086
    Likes Received:
    118
    Trophy Points:
    63
    Location:
    Webb City, Missouri
    Home page:
    That'll be the NSA knocking at your door then.....
    booman likes this.
  17. Daniel~

    Daniel~ Chief BBS Administrator Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    7,994
    Likes Received:
    121
    Trophy Points:
    63
    Location:
    Greenwater WA
    Home page:
    Dude1 You said the "P" word. In the name of your personal security
    (And to the preserve all our lives.)

    we should probably encrypt it, remove it from our servers and bury it at the bottom of the Ocean.

    ...Wait I'm Channeling Cloisters.

    at this critical moment in personal freedom we must summon all our resource to try and anticipate their next attach!
    No body does creative paranoia like George can!!

    He's speaking though me now!

    Forget It George says the NSA is already at the bottom of the Ocean foreseeing and thus preventing yet another terrorist act by an American trying to keep a Personal Secret...

    Look guys...maybe if we promise to never do another good thing they will let us all just step away quietly and resume our former lives... before all this almost happened to us!

    Maybe they will let us keep the bits before the "P" word began to be carelessly tossed about?
    Gizmo! How did you let this happen! I thought you were watching things! ":O}
  18. cloasters

    cloasters Well-Known Member

    Joined:
    Jul 3, 2013
    Messages:
    4,239
    Likes Received:
    55
    Trophy Points:
    48
    Moi, paranoid? I can't say that is impossible. I think I can say that no personal privacy exists anywhere, and there will be none in the future. But this keeps us safe!!!
  19. Daniel~

    Daniel~ Chief BBS Administrator Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    7,994
    Likes Received:
    121
    Trophy Points:
    63
    Location:
    Greenwater WA
    Home page:
    I did say creative....":O}
  20. cloasters

    cloasters Well-Known Member

    Joined:
    Jul 3, 2013
    Messages:
    4,239
    Likes Received:
    55
    Trophy Points:
    48
    In a world that's full of tear me downs, or one could say destructions, a vote of confidence is always welcome.

Share This Page