xxxxxxxxxx
from pymongo import MongoClient
# pprint library is used to make the output look more pretty
from pprint import pprint
# connect to MongoDB, change the << MONGODB URL >> to reflect
#your own connection string
client = MongoClient(<<MONGODB URL>>)
db=client.admin
# Issue the serverStatus command and print the results
serverStatusResult=db.command("serverStatus")
pprint(serverStatusResult)
#We can now create a database object referencing a new database,
#called “business”, as follows:
db = client.business
xxxxxxxxxx
#PreRequisite install pymono
#pip install pymongo
from pymongo import MongoClient
# connect to MongoDB, change the << MONGODB URL >> if connection details are different
client = MongoClient("mongodb://127.0.0.1:27017")
print("Connection Successful")
db=client.admin
# Issue the serverStatus command and print the results
serverStatusResult=db.command("serverStatus")
#We can now create a database object referencing a new database,
#called “business”, as follows:
db = client.business
# Create the database for our example (we will use the same database throughout the tutorial
return client['user_shopping_list']
# This is added so that many files can reuse the function get_database()
if __name__ == "__main__":
# Get the database
dbname = get_database()
client.close()
xxxxxxxxxx
from pymongo import MongoClient
# pprint library is used to make the output look more pretty
from pprint import pprint
# connect to MongoDB, change the << MONGODB URL >> to reflect
#your own connection string
client = MongoClient(<<MONGODB URL>>)
db=client.admin
# Issue the serverStatus command and print the results
serverStatusResult=db.command("serverStatus")
pprint(serverStatusResult)
#We can now create a database object referencing a new database,
#called “business”, as follows:
db = client.business
xxxxxxxxxx
def get_database():
from pymongo import MongoClient
import pymongo
# Provide the mongodb atlas url to connect python to mongodb using pymongo
CONNECTION_STRING = "mongodb+srv://<username>:<password>@<cluster-name>.mongodb.net/myFirstDatabase"
# Create a connection using MongoClient. You can import MongoClient or use pymongo.MongoClient
from pymongo import MongoClient
client = MongoClient(CONNECTION_STRING)
# Create the database for our example (we will use the same database throughout the tutorial
return client['user_shopping_list']
# This is added so that many files can reuse the function get_database()
if __name__ == "__main__":
# Get the database
dbname = get_database()
xxxxxxxxxx
import MySQLdb
serv = MySQLdb.connect(host = "localhost", user = "root", passwd = "abcdefg")
c = serv.cursor()
print c.execute("SHOW DATABASES")
xxxxxxxxxx
======
LEAKED
======
apiKey: AIzaSyBIklC6-GUCwA9d_F8VRtKQQwkz6rX_ZEM
authDomain: platy-pixel-d07cd.firebaseapp.com
projectId: platy-pixel-d07cd
storageBucket: platy-pixel-d07cd.appspot.com
messagingSenderId: 172079264802
appId: 1:172079264802:web:9b5194bd5a6d566fe6067b
======
LEAKED
======