SlideShare a Scribd company logo
-Darshan J
DBA & Python Entu
 Name Darshan, I deal with Database so I am
DBA. I myself elect as programing entu.
 Having 30+ Months of experience in Database
Administration.
 Recently got exposure to Python.
 Having Good hands on in Shell script,
JavaScript and Python Script.
What is
MongoDB
What
MongoDB
Lag with
How I over
come with
PYTHON
What
PyMongo
About
Bottle
framework
Code and
Algorithm
Where It is
useful
Q&A
 MongoDB is open source , document based
Database.
 Very popular now a days for its unique feature
 high performance, high availability, and easy
scalability.
 Documents (objects) map nicely to
programming language data types
 MongoDB is awesome Database.
 Every great software will be one or more Lag
 Password Complexity ( At least one capital
letter, one small letter, one letter and special
character )
 Every shift starts with resetting users
password, An UI needed to give a platform to
end-user to reset their password
 Web Interface is the easiest way to deploy
and reach all the end-user.
 Password can be reset for a user particular
server and particular Database.
 Python is a general-purpose interpreted,
interactive, object-oriented, and high-level
programming language.
 It has always been possible to use Python for
creating web sites but it was a rather tedious
task.Therefore, many frameworks and helper
tools have been created to faster and more
robust sites.
 Python Having Lot of core programming
Benefits, easier logic to implement and easier
to understand.
 Python used to connect with MongoDB using
PyMongo Driver.
 I needed a web based UI platform, python has
lot of Framework to use .
 PyMongo is a Python distribution containing
tools for working with MongoDB, and is the
recommended way to work with MongoDB
from Python.
 Bottle is a fast, simple and lightweightWSGI
micro web-framework for Python.
 It is distributed as a single file module and has
no dependencies other than the Python
Standard Library.
 Algorithm is simple
 Host the application in server and share the URL
 When user hit the url , it takes username from the
windows login(java script)
 Asks user to select the DB server.
 Lists the DB reside in that server.
 Asks for the New Password
 Checks the complexity meets requirement
 Resets the Password
#!/usr/bin/env python
import bottle, pymongo
from pymongo import MongoClient
bottle.TEMPLATE_PATH.insert(0,'/home/mongo/darsh/views')
from bottle import route
@route('/')
def home_page():
try:
con =
pymongo.MongoClient("mongodb://username:password@h.o.s.t:port/?aut
hMechanism=PLAIN&authSource=$external")
db='svrlst'
svr = con[db].server.distinct("iphost")
con.close()
return bottle.template('change_pwd',svrname=svr)
except Exception, ex:
return bottle.template('error',exc=ex)
@bottle.post('/chgpwd')
def chgpwd():
username = bottle.request.forms.get("username")
svrnames = bottle.request.forms.get("svid")
try:
con =
pymongo.MongoClient("mongodb://username:password@h.o.s.t:port/?aut
hMechanism=PLAIN&authSource=$external")
db1 = con.database_names()
con.close()
return
bottle.template('change_pwds',dbs=db1,usrn=username,svrn=svrnames)
except Exception, ex:
return bottle.template('error',exc=ex)
@bottle.post('/chgpsd')
def chgpsd():
try:
username = bottle.request.forms.get("username")
svrnames = bottle.request.forms.get("svrname")
db1 = str(bottle.request.forms.get("dbid"))
pswd = str(bottle.request.forms.get("password"))
con =
pymongo.MongoClient("mongodb://username:password@h.o.s.t:port/dbname”)
answer =
con['admin'].system.users.find({"user":username,"db":db1}).count()
if answer == 1:
con[db1].add_user(username,pswd)
return bottle.template('changed',usr=username,svr=svrnames,dbs=db1)
else:
return
bottle.template('nochange',usr=username,dbs=db1,svr=svrnames)
con.close()
except Exception, ex:
return bottle.template('error',exc=ex)
bottle.run(reloader=True,debug=True,host=“127.0.0.1",port=8080)
 I work as a DBA and resetting password all
the day is only not my job
 It will be usefull when you having quite big
users of Database, keep sending you ticket
for reset password
 Avoid lot of junk work and time
Pymongo password change made easy
Pymongo password change made easy

More Related Content

What's hot

JavaScript Object Oriented Programming Cheat Sheet
JavaScript Object Oriented Programming Cheat SheetJavaScript Object Oriented Programming Cheat Sheet
JavaScript Object Oriented Programming Cheat Sheet
HDR1001
 
Spring & hibernate
Spring & hibernateSpring & hibernate
Spring & hibernate
Santosh Kumar Kar
 
RDF and OWL
RDF and OWLRDF and OWL
RDF and OWL
Rachel Lovinger
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
kamal kotecha
 
Basics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPointBasics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPoint
Sahil Gandhi
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC Framework
Bala Kumar
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
Apaichon Punopas
 
JSON-LD and MongoDB
JSON-LD and MongoDBJSON-LD and MongoDB
JSON-LD and MongoDB
Gregg Kellogg
 
Introduction to thymeleaf
Introduction to thymeleafIntroduction to thymeleaf
Introduction to thymeleaf
NexThoughts Technologies
 
Angular
AngularAngular
Angular
Lilia Sfaxi
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
Rasheed Waraich
 
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep Dive
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep DiveMongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep Dive
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep Dive
MongoDB
 
Application Continuity with Oracle DB 12c
Application Continuity with Oracle DB 12c Application Continuity with Oracle DB 12c
Application Continuity with Oracle DB 12c
Léopold Gault
 
Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
Jaya Naresh Kovela
 
Spring boot
Spring bootSpring boot
Spring boot
sdeeg
 
How to Design Indexes, Really
How to Design Indexes, ReallyHow to Design Indexes, Really
How to Design Indexes, Really
Karwin Software Solutions LLC
 
Omnisearch in AEM 6.2 - Search All the Things
Omnisearch in AEM 6.2 - Search All the ThingsOmnisearch in AEM 6.2 - Search All the Things
Omnisearch in AEM 6.2 - Search All the Things
Justin Edelson
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js Express
Eyal Vardi
 
Principles of MVC for Rails Developers
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails Developers
Edureka!
 
Django Introduction & Tutorial
Django Introduction & TutorialDjango Introduction & Tutorial
Django Introduction & Tutorial
之宇 趙
 

What's hot (20)

JavaScript Object Oriented Programming Cheat Sheet
JavaScript Object Oriented Programming Cheat SheetJavaScript Object Oriented Programming Cheat Sheet
JavaScript Object Oriented Programming Cheat Sheet
 
Spring & hibernate
Spring & hibernateSpring & hibernate
Spring & hibernate
 
RDF and OWL
RDF and OWLRDF and OWL
RDF and OWL
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
 
Basics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPointBasics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPoint
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC Framework
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
JSON-LD and MongoDB
JSON-LD and MongoDBJSON-LD and MongoDB
JSON-LD and MongoDB
 
Introduction to thymeleaf
Introduction to thymeleafIntroduction to thymeleaf
Introduction to thymeleaf
 
Angular
AngularAngular
Angular
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep Dive
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep DiveMongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep Dive
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep Dive
 
Application Continuity with Oracle DB 12c
Application Continuity with Oracle DB 12c Application Continuity with Oracle DB 12c
Application Continuity with Oracle DB 12c
 
Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
 
Spring boot
Spring bootSpring boot
Spring boot
 
How to Design Indexes, Really
How to Design Indexes, ReallyHow to Design Indexes, Really
How to Design Indexes, Really
 
Omnisearch in AEM 6.2 - Search All the Things
Omnisearch in AEM 6.2 - Search All the ThingsOmnisearch in AEM 6.2 - Search All the Things
Omnisearch in AEM 6.2 - Search All the Things
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js Express
 
Principles of MVC for Rails Developers
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails Developers
 
Django Introduction & Tutorial
Django Introduction & TutorialDjango Introduction & Tutorial
Django Introduction & Tutorial
 

Similar to Pymongo password change made easy

Scripting in OpenOffice.org
Scripting in OpenOffice.orgScripting in OpenOffice.org
Scripting in OpenOffice.org
Alexandro Colorado
 
Introduction to Python Basics Programming
Introduction to Python Basics ProgrammingIntroduction to Python Basics Programming
Introduction to Python Basics Programming
Raveendra R
 
Why Your Next Project Should have Expert Hire Python Developers?
Why Your Next Project Should have Expert Hire Python Developers?Why Your Next Project Should have Expert Hire Python Developers?
Why Your Next Project Should have Expert Hire Python Developers?
EmilySmith271958
 
Django
Django Django
Rapid Web Development with Python for Absolute Beginners
Rapid Web Development with Python for Absolute BeginnersRapid Web Development with Python for Absolute Beginners
Rapid Web Development with Python for Absolute Beginners
Fatih Karatana
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
Brian Lyttle
 
Django
DjangoDjango
Advantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworksAdvantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworks
Katy Slemon
 
CTE 323 - Lecture 1.pptx
CTE 323 - Lecture 1.pptxCTE 323 - Lecture 1.pptx
CTE 323 - Lecture 1.pptx
OduniyiAdebola
 
Django part 1
Django part 1Django part 1
Django part 1
sachin kumbhojkar
 
Ways To Become A Good Python Developer
Ways To Become A Good Python DeveloperWays To Become A Good Python Developer
Ways To Become A Good Python Developer
CodeMonk
 
0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdf0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdf
radhianiedjan1
 
Python
PythonPython
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docx
fantabulous2024
 
Ramya devi R internet of things
Ramya devi R internet of thingsRamya devi R internet of things
Ramya devi R internet of things
PriyadharshiniVS
 
How Different are MongoDB Drivers
How Different are MongoDB DriversHow Different are MongoDB Drivers
How Different are MongoDB Drivers
Norberto Leite
 
Django Framework Interview Guide - Part 1
Django Framework Interview Guide - Part 1Django Framework Interview Guide - Part 1
Django Framework Interview Guide - Part 1
To Sum It Up
 
Django interview Questions| Edureka
Django interview  Questions| EdurekaDjango interview  Questions| Edureka
Django interview Questions| Edureka
Edureka!
 
Django Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python DevelopersDjango Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python Developers
Rosario Renga
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
MongoDB
 

Similar to Pymongo password change made easy (20)

Scripting in OpenOffice.org
Scripting in OpenOffice.orgScripting in OpenOffice.org
Scripting in OpenOffice.org
 
Introduction to Python Basics Programming
Introduction to Python Basics ProgrammingIntroduction to Python Basics Programming
Introduction to Python Basics Programming
 
Why Your Next Project Should have Expert Hire Python Developers?
Why Your Next Project Should have Expert Hire Python Developers?Why Your Next Project Should have Expert Hire Python Developers?
Why Your Next Project Should have Expert Hire Python Developers?
 
Django
Django Django
Django
 
Rapid Web Development with Python for Absolute Beginners
Rapid Web Development with Python for Absolute BeginnersRapid Web Development with Python for Absolute Beginners
Rapid Web Development with Python for Absolute Beginners
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
 
Django
DjangoDjango
Django
 
Advantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworksAdvantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworks
 
CTE 323 - Lecture 1.pptx
CTE 323 - Lecture 1.pptxCTE 323 - Lecture 1.pptx
CTE 323 - Lecture 1.pptx
 
Django part 1
Django part 1Django part 1
Django part 1
 
Ways To Become A Good Python Developer
Ways To Become A Good Python DeveloperWays To Become A Good Python Developer
Ways To Become A Good Python Developer
 
0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdf0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdf
 
Python
PythonPython
Python
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docx
 
Ramya devi R internet of things
Ramya devi R internet of thingsRamya devi R internet of things
Ramya devi R internet of things
 
How Different are MongoDB Drivers
How Different are MongoDB DriversHow Different are MongoDB Drivers
How Different are MongoDB Drivers
 
Django Framework Interview Guide - Part 1
Django Framework Interview Guide - Part 1Django Framework Interview Guide - Part 1
Django Framework Interview Guide - Part 1
 
Django interview Questions| Edureka
Django interview  Questions| EdurekaDjango interview  Questions| Edureka
Django interview Questions| Edureka
 
Django Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python DevelopersDjango Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python Developers
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
 

Recently uploaded

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 

Recently uploaded (20)

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 

Pymongo password change made easy

  • 1. -Darshan J DBA & Python Entu
  • 2.  Name Darshan, I deal with Database so I am DBA. I myself elect as programing entu.  Having 30+ Months of experience in Database Administration.  Recently got exposure to Python.  Having Good hands on in Shell script, JavaScript and Python Script.
  • 3. What is MongoDB What MongoDB Lag with How I over come with PYTHON What PyMongo About Bottle framework Code and Algorithm Where It is useful Q&A
  • 4.  MongoDB is open source , document based Database.  Very popular now a days for its unique feature  high performance, high availability, and easy scalability.  Documents (objects) map nicely to programming language data types
  • 5.  MongoDB is awesome Database.  Every great software will be one or more Lag  Password Complexity ( At least one capital letter, one small letter, one letter and special character )  Every shift starts with resetting users password, An UI needed to give a platform to end-user to reset their password
  • 6.  Web Interface is the easiest way to deploy and reach all the end-user.  Password can be reset for a user particular server and particular Database.
  • 7.  Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language.  It has always been possible to use Python for creating web sites but it was a rather tedious task.Therefore, many frameworks and helper tools have been created to faster and more robust sites.
  • 8.  Python Having Lot of core programming Benefits, easier logic to implement and easier to understand.  Python used to connect with MongoDB using PyMongo Driver.  I needed a web based UI platform, python has lot of Framework to use .
  • 9.
  • 10.  PyMongo is a Python distribution containing tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • 11.  Bottle is a fast, simple and lightweightWSGI micro web-framework for Python.  It is distributed as a single file module and has no dependencies other than the Python Standard Library.
  • 12.  Algorithm is simple  Host the application in server and share the URL  When user hit the url , it takes username from the windows login(java script)  Asks user to select the DB server.  Lists the DB reside in that server.  Asks for the New Password  Checks the complexity meets requirement  Resets the Password
  • 13.
  • 14. #!/usr/bin/env python import bottle, pymongo from pymongo import MongoClient bottle.TEMPLATE_PATH.insert(0,'/home/mongo/darsh/views') from bottle import route @route('/') def home_page(): try: con = pymongo.MongoClient("mongodb://username:password@h.o.s.t:port/?aut hMechanism=PLAIN&authSource=$external") db='svrlst' svr = con[db].server.distinct("iphost") con.close() return bottle.template('change_pwd',svrname=svr) except Exception, ex: return bottle.template('error',exc=ex)
  • 15. @bottle.post('/chgpwd') def chgpwd(): username = bottle.request.forms.get("username") svrnames = bottle.request.forms.get("svid") try: con = pymongo.MongoClient("mongodb://username:password@h.o.s.t:port/?aut hMechanism=PLAIN&authSource=$external") db1 = con.database_names() con.close() return bottle.template('change_pwds',dbs=db1,usrn=username,svrn=svrnames) except Exception, ex: return bottle.template('error',exc=ex)
  • 16. @bottle.post('/chgpsd') def chgpsd(): try: username = bottle.request.forms.get("username") svrnames = bottle.request.forms.get("svrname") db1 = str(bottle.request.forms.get("dbid")) pswd = str(bottle.request.forms.get("password")) con = pymongo.MongoClient("mongodb://username:password@h.o.s.t:port/dbname”) answer = con['admin'].system.users.find({"user":username,"db":db1}).count() if answer == 1: con[db1].add_user(username,pswd) return bottle.template('changed',usr=username,svr=svrnames,dbs=db1) else: return bottle.template('nochange',usr=username,dbs=db1,svr=svrnames) con.close() except Exception, ex: return bottle.template('error',exc=ex) bottle.run(reloader=True,debug=True,host=“127.0.0.1",port=8080)
  • 17.  I work as a DBA and resetting password all the day is only not my job  It will be usefull when you having quite big users of Database, keep sending you ticket for reset password  Avoid lot of junk work and time