Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7ad986d
deploying
imvickykumar999 Feb 20, 2022
55773ba
Update requirements.txt
imvickykumar999 Feb 20, 2022
dda3423
Create Procfile
imvickykumar999 Feb 20, 2022
d8e46de
Update requirements.txt
imvickykumar999 Feb 20, 2022
7be5407
db create
imvickykumar999 Feb 20, 2022
dd28c94
Update requirements.txt
imvickykumar999 Feb 20, 2022
a8a0d11
Rename readme.md to README.md
imvickykumar999 Feb 20, 2022
4452fd4
default page
imvickykumar999 Feb 20, 2022
f55bc71
add user info
imvickykumar999 Feb 22, 2022
aa2859d
upload image
imvickykumar999 Feb 22, 2022
039db47
pro file upload done
imvickykumar999 Feb 23, 2022
7feda4a
Update app.py
imvickykumar999 Feb 25, 2022
0d49ca2
automate login
imvickykumar999 Feb 25, 2022
8587332
readme
imvickykumar999 Feb 25, 2022
76b56e7
Update README.md
imvickykumar999 Feb 25, 2022
98296ff
random 50
imvickykumar999 Feb 25, 2022
2681184
import By
imvickykumar999 Feb 25, 2022
c521f01
../user/bot_1234567891011
imvickykumar999 Feb 25, 2022
42ebf50
Update README.md
imvickykumar999 Feb 25, 2022
acc29ad
Update README.md
imvickykumar999 Feb 25, 2022
1f5e0e7
insta login automate
imvickykumar999 Feb 25, 2022
401a626
Bank Account
imvickykumar999 Feb 27, 2022
4f974d7
Update README.md
imvickykumar999 Feb 27, 2022
2bcb5d1
Update requirements.txt
imvickykumar999 Feb 27, 2022
91784f8
Merge branch 'master' of https://github.com/imvickykumar999/Selenium-…
imvickykumar999 Feb 27, 2022
b65daed
paytm
imvickykumar999 Feb 27, 2022
60164d1
Update README.md
imvickykumar999 Feb 27, 2022
d367bd9
Update README.md
imvickykumar999 Feb 27, 2022
ed1b9b5
transfer
imvickykumar999 Feb 27, 2022
95440ad
Merge branch 'master' of https://github.com/imvickykumar999/Selenium-…
imvickykumar999 Feb 27, 2022
9e810d0
Update README.md
imvickykumar999 Feb 27, 2022
e81d2c8
dp removed
imvickykumar999 Feb 28, 2022
ac1ef7e
dp url
imvickykumar999 Mar 5, 2022
12b0a30
Update insta login.py
imvickykumar999 Mar 7, 2022
c8955af
fire image base64
imvickykumar999 Mar 8, 2022
b593f74
search friends
imvickykumar999 Mar 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn --worker-class eventlet -w 1 app:app
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Flask Simple Login without Extensions

### [https://techmonger.github.io/10/flask-simple-authentication/](https://techmonger.github.io/10/flask-simple-authentication/)

----------------------------------

[![image](https://user-images.githubusercontent.com/50515418/155890748-ba122dba-7104-4983-88db-8770e00d828d.png)](https://vixtest.herokuapp.com/signup/)

## Getting Started

- Install required packages `pip -r install requirements.txt`
- Run below command, To create new Database...

```
python
>>> from app import create_db
>>> create_db()
```

- or, `python create_db.py`

-------------------------------------------------

## Run application
`python app.py`

- Create new account http://127.0.0.1:5000/signup
- Login account http://127.0.0.1:5000/login
- 🔥 Then Send Money to other Accounts.

## For Automate Login

cd vicks
python cracker.py
Binary file added __pycache__/app.cpython-39.pyc
Binary file not shown.
259 changes: 259 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
"""
Simple login mechanism implemented with Flask and Flask-Sqlalchemy
Makes use of werkzeug.security for password hashing.

1. Create new user with signup form.
2. Authenticate user with Login form
3. Send authorized user to home page

https://techmonger.github.io/10/flask-simple-authentication/
"""

from flask import Flask, render_template, request, url_for, redirect, flash, \
session, abort, send_from_directory
from flask_sqlalchemy import sqlalchemy, SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
from werkzeug.utils import secure_filename
import os

# Change dbname here
db_name = "auth.db"

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{db_name}'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

UPLOAD_FOLDER = 'static'
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER

# SECRET_KEY required for session, flash and Flask Sqlalchemy to work
app.config['SECRET_KEY'] = 'configure strong secret key here'

db = SQLAlchemy(app)
# db.create_all()

class User(db.Model):
uid = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(100), unique=True, nullable=False)
bio = db.Column(db.String(500), nullable=True)
dp_url = db.Column(db.String(600), nullable=True)
pass_hash = db.Column(db.String(100), nullable=False)

def __repr__(self):
return '' % self.username


def create_db():
""" # Execute this first time to create new db in current directory. """
db.create_all()


@app.route('/static/<filename>')
def send_reels(filename):
return send_from_directory("static", filename)


@app.route("/signup/", methods=["GET", "POST"])
def signup():
# when someone signup, set amount as 0 in firebase

"""
Implements signup functionality. Allows username and password for new user.
Hashes password with salt using werkzeug.security.
Stores username and hashed password inside database.

Username should to be unique else raises sqlalchemy.exc.IntegrityError.
"""

if request.method == "POST":
username = request.form['username'].strip()
password = request.form['password'].strip()

bio = request.form['bio']
print('=====>>> ', type(bio))
if bio is None:
bio = 'hey...'

# --------------------------------------

# dp_url = request.form['dp_url'].strip()

file = request.files['files[]']
filename = secure_filename(file.filename)
print('********--> ', (file.filename))

if filename == '':
loc = 'static/Profile_NULL.png'
else:
loc = os.path.join(app.config['UPLOAD_FOLDER'], filename)
file.save(loc)

# saving image in firebase as binary base64
from vicks import image_upload as fire
print('---------> ', loc)
obj = fire.Upload(username, loc)
obj.img2txt()

# --------------------------------------

if not (username and password):
flash("Username or Password cannot be empty")
return redirect(url_for('signup'))
else:
username = username.strip()
password = password.strip()

# Returns salted pwd hash in format : method$salt$hashedvalue
hashed_pwd = generate_password_hash(password, 'sha256')
# print(hashed_pwd)

new_user = User(username=username, bio=bio, pass_hash=hashed_pwd, dp_url=loc)
db.session.add(new_user)

try:
db.session.commit()
except sqlalchemy.exc.IntegrityError:
flash("Username {u} is not available.".format(u=username))
return redirect(url_for('signup'))

flash("User account has been created.")
return redirect(url_for("login"))

return render_template("signup.html")


# @app.route("/", methods=["GET", "POST"])
@app.route("/login/", methods=["GET", "POST"])
def login():
"""
Provides login functionality by rendering login form on get request.
On post checks password hash from db for given input username and password.
If hash matches redirects authorized user to home page else redirect to
login page with error message.
"""

if request.method == "POST":
username = request.form['username']
password = request.form['password']

if not (username and password):
flash("Username or Password cannot be empty.")
return redirect(url_for('login'))
else:
username = username.strip()
password = password.strip()

user = User.query.filter_by(username=username).first()

if user and check_password_hash(user.pass_hash, password):
session[username] = True
return redirect(url_for("user_home", username=username))
else:
flash("Invalid username or password.")

flash('''If your account has lost,
please signup again with same username,
your money has not lost yet.''')

return render_template("login_form.html")


@app.route("/user/<username>")
def user_home(username):
"""
Home page for validated users.

"""
if not session.get(username):
abort(401)

from vicks import image_upload as fire
obj = fire.Bank_Account(username)

user = User.query.filter_by(username=username).first()
print('======>>> ', user.dp_url)
up_obj = fire.Upload(username, user.dp_url)
up_obj.txt2img()

friend_list = fire.friends().keys()
return render_template("user_home.html",
username=username,
bio=user.bio,
friend_list=friend_list,
dp_url=user.dp_url,
disp = obj.display()
)


@app.route("/account/<username>", methods=["GET", "POST"])
def user_account(username):
"""
Home page for validated users.

"""
if not session.get(username):
abort(401)

money = float(request.form['money'])
from vicks import image_upload as fire

'''
# flower as fire

flower samjhi kya ?
fire hai mai... XD

(firebase chatting feature will be add soon...)
'''

obj = fire.Bank_Account(username)
pay = request.form['pay']
obj_pay = fire.Bank_Account(pay)

if money>0:
obj_pay.deposit(money)
disp = obj.withdraw(money)

flash(f'''
Paid Successfully
''')

else:
disp = obj.display()
flash("Amount should NOT be Negative number.")

user = User.query.filter_by(username=username).first()
obj = fire.Upload(username, user.dp_url)
obj.txt2img()

friend_list = fire.friends().keys()
return render_template("user_home.html",
username=username,
bio=user.bio,
friend_list=friend_list,
dp_url=user.dp_url,
disp = disp,
)


@app.route("/logout/<username>")
def logout(username):
""" Logout user and redirect to login page with success message."""
session.pop(username, None)
flash("successfully logged out.")
return redirect(url_for('login'))


@app.route("/")
def index():
return render_template('index.html')


@app.errorhandler(404)
def page_not_found(e):
e = 'Error 404, Page not Found'
return ( render_template('404.html', e=e), 404 )


if __name__ == "__main__":
app.run(port=5000, debug=True)
Binary file added auth.db
Binary file not shown.
5 changes: 5 additions & 0 deletions create_db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# to create `auth.db` file

from app import create_db
create_db()
12 changes: 12 additions & 0 deletions fireson.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "ideationology-4c639",
"private_key_id": "5806b97f02b35ecef648d4684bfd3436a7e114c8",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCf7mMeTZBpJylC\no8aavaZIw1eTAsdwxeuZVfRe84YKfkFlEoeR/dILyLMslRBOZgWJKBeOYf1oxB5e\nkMHABX+VoMII3V0l/tFjD2kCL/EJBFA2Zr0Q7HbtJGYSK3XBtJpsJgPzkgxIQJ7I\nCL8M6A3HshpQxQM10KGukcjoN+LNAzVnpzq7bFFoFcid7HZ7VKWxbKIqpTIPrAmU\n8mw4OpXiESZj+1SjURv0qw2zpk/VzydBdsmN9KCRuZuqTrcN+sfEcxD5Ve3l5BwX\nNeKy02DFAfaNhXFUGEUQJiR4yvwMS0Gh2GCy4JLJ/rBO5Kz9BGN3hu0gLVZQWRHo\ndf2K7BX5AgMBAAECggEAAfI3L4+3EaiB1odCq/Bh3SHPZ4ERpzwpVUjX++3PtEH8\nDrxOfQbPLwiGsaSwuZuBNr2Pp9JmcIdubS0qxmjquAnoQo5bC1LR/ngaCYZG0xrD\n1R2j8FhITDN0sITp3m0Rsf42bxjYYGq04+9DT+dk/4iZzGDRXK7IwOSSQs0nS+JY\nrYumoobXtRbbhXzlLWmN7WRuIrOTVfe4hn1NV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email": "firebase-adminsdk-5hfwu@ideationology-4c639.iam.gserviceaccount.com",
"client_id": "109034743683577347554",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-5hfwu%40ideationology-4c639.iam.gserviceaccount.com"
}
Loading