r/AskProgrammers • • 15d ago

Script to connect to a website

Hi all ✌️

I was wondering, is it doable to make a (shell?) Script that opens a website and connects me to it.

Like using curl to send the information once the page is open.

I was wondering because I would like to use more private navigation without having to enter my infos every time.

I did some research on the web and didn't find what I was looking for.

3 Upvotes

20 comments sorted by

2

u/sububi71 15d ago

So how would this script be different - from the server's viewpoint - to a browser with no javascript and no cookies?

What are you ACTUALLY trying to achieve?

1

u/RVTEL666 15d ago

Yo, that's a good question. I guess the difference would be more for me. What I want to do is having a Script that logging for me without having me to type username + password every time I wanna go to that website in private navigation. I responded in an other comment "pseudo code" If you need

3

u/bahcodad 15d ago

This would be a security nightmare IMO. I suggest using a password manager (I like bitwarden) and autofill. This way you only need to type your password in for the session and all your logins can be autofilled.

Edit: this also means this will work across devices

1

u/RVTEL666 14d ago

Okok thanks for the advice. Could you describe why would it be a security issue? I was trying to avoid password manager. My train of thought was if my password manager leaked, the whole of my password would be in the wild.

2

u/bahcodad 14d ago

Let me ask some questions first.

  • How would you store your password?
  • How would you ensure that your script isn't leaked?
  • What makes you think that your script would be more secure than a well known and trusted password manager?

1

u/RVTEL666 14d ago
  1. I was more looking if it was doable/good idea of the whole thing. Didn't start thinking about how to set it up safely. But my first thought would be raw string and trusting tcp encryption
  2. trusting the integrity of my devices/network
  3. My reflection was something like: I'm a single random user. What does make me more visible and interesting to hackers than a company well known ?

As you may have understood I'm a rookie

→ More replies (1)

1

u/cabiwabi 15d ago

Web servers typically don't support an ongoing open connection. You send either a GET request to fetch information or a POST request to send it.

Could you describe what you're looking to do rather than the methodology?

1

u/RVTEL666 15d ago

Hi pal, thanks for the response. What I'm looking to do as pseudo code would be open htpps://exemple.com/login in private navigation ; curl POST myinfos.username myinfo.password

And that's it pretty much. Let me know if it does make sensπŸ™

1

u/Fadamaka 15d ago

What is private navigation?

1

u/RVTEL666 14d ago

Private browsing (also known as incognito mode or private mode). My bad, not English native πŸ˜…

→ More replies (1)

1

u/feudalle 14d ago

If the site takes a direct post sure. Oh course modern sites are going to know the browser you are using isnt logged in and will require you to log in again. Curl is a seperate thing. Use a password manager.

1

u/RVTEL666 14d ago

I'll copy/paste what I reply about password manager from an another comment: "I was trying to avoid password manager. My train of thought was if my password manager leaked, the whole of my password would be in the wild."

1

u/feudalle 14d ago

Thats fair. But you are just trying to setup a password manager yourself. Which os doable but starting with using curl shows good thought process but not experience. You end up with something a lot more hackable than a professional company offering password managers. Personally I've moved to mfa/sso for just about everything.

1

u/RVTEL666 14d ago

But what I was thinking is, I'm a random user. Who does care about me and could ppl know that I'm running such a process. The professional company is known as it. It may be, then, a bigger target than I am ? But the more I read you guys the more I think that you are right. I'm just trying to understand what I've been thinking wrong and how could fill in the gaps in my knowledge

→ More replies (1)
→ More replies (1)

1

u/cabiwabi 14d ago edited 14d ago

Are you okay with running python? In the past I've used 'beautiful soup' in a terminal to log in and parse web content before.

Are you trying to filter out spammy content like ads, or remain anonymous?

EDIT: I read your other comments and I understand a bit more now. I have to agree that a password manager is the best solution. It's a good thing that you are concerned about your account security. I'd reccomend watching a video on how they work and how best to use them. I use bitwarden which I would reccomend.

Its possible to build your own solution, but it's a problem that has been solved many times before with excellent engineering under the hood. If you're still interested in building your own then absolutely try it for sure. But it's probably better to trust a password manager over some scripting you hack together.

1

u/RVTEL666 14d ago

Thanks for the interest! Did you watch one in particular?