[
  {
    "path": "Protect.py",
    "content": "import face_recognition\nimport cv2\nimport numpy as np\nimport pyautogui\nfrom selenium import webdriver\nimport time\nimport os\n\n\ngmail = \"ENTER GMAIL HERE\"\npassword = \"ENTER PASSWORD HERE\"\n\nvideo_capture = cv2.VideoCapture(0)\n\nroot_image = face_recognition.load_image_file(\"YOUR PHOTO PATH\")\nroot_encoding = face_recognition.face_encodings(root_image)[0]\n\n\nknown_face_encodings = [\n    root_encoding,\n]\nknown_face_names = [\n    \"YOUR NAME\",\n]\n\nwhile True:\n    ret, frame = video_capture.read()\n\n    rgb_frame = frame[:, :, ::-1]\n\n    face_locations = face_recognition.face_locations(rgb_frame)\n    face_encodings = face_recognition.face_encodings(rgb_frame, face_locations)\n    name = \"Unknown\"\n\n    for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings):\n        # See if the face is a match for the known face(s)\n        matches = face_recognition.compare_faces(known_face_encodings, face_encoding)\n\n        face_distances = face_recognition.face_distance(known_face_encodings, face_encoding)\n        best_match_index = np.argmin(face_distances)\n        if matches[best_match_index]:\n            name = known_face_names[best_match_index]\n\n        cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2)\n\n        cv2.rectangle(frame, (left, bottom - 35), (right, bottom), (0, 0, 255), cv2.FILLED)\n        font = cv2.FONT_HERSHEY_DUPLEX\n        cv2.putText(frame, name, (left + 6, bottom - 6), font, 1.0, (255, 255, 255), 1)\n    if name != \"YOUR NAME\":\n        driver = webdriver.Chrome(executable_path=\"CHROME DRIVER PATH\")\n        driver.get(\"https://www.google.com/android/find\")\n        time.sleep(2)\n        pyautogui.typewrite(gmail)\n        pyautogui.press(\"enter\")\n        time.sleep(2)\n        pyautogui.typewrite(password)\n        pyautogui.press(\"enter\")\n        time.sleep(5)\n        pyautogui.click(x=85,y=231)\n        time.sleep(2)\n        pyautogui.click(x=200,y=495)\n        pyautogui.hotkey('ctrlleft', 'altleft', 'l')\n\n    else:\n        print(\"Welcome BOSS\")\n        os.system(\"gnome-terminal\")\n\n    # Display the resulting image\n    cv2.imshow('Video', frame)\n\n\n# Release handle to the webcam\nvideo_capture.release()\ncv2.destroyAllWindows()\n"
  },
  {
    "path": "README.md",
    "content": "# FaceRecognitionSecurity\nProtect your Computer against strangers ! If foreigners want to log in to your computer, ring your phone and lock the computer screen automatically.\n## Features\n\nFace Recognition in Live Camera\n\n![github-small](36f0e3f0-13cb-11e7-8258-4d0c9ce1e419.gif)\n\n\n## Installation\n### Requirements\n• Python 3.3+ or Python 2.7\n\n• macOS or Linux (Windows not officially supported, but might work)\n\n• For Install \"face_recognition and dlib\" : [Click Here!](https://github.com/ageitgey/face_recognition)\n\n• Chrome Driver : https://chromedriver.chromium.org/downloads\n\n## Usage\n![github-small](obama.png)\n\n• Change GMAIL,PASSWORD,DRIVER LOCATION and PHOTO LOCATION in Protect.py \n\n```\nIf you don't have a photo run 'python Take Photo.py' and Press SPACE for Take Photo.\nElse run 'python Protect.py'\n```\n\n• If Camera Detect Your Face Open a new Terminal.Otherwise The Phone Will Ring Even If It is Silent.\n\n• Connect to the Google Android Find My Phone and Click the Ring the Phone Button and Lock the Screen.\n\n![github-small](phone.png)\n\n\n## Contact\n\n[<img target=\"_blank\" src=\"https://img.icons8.com/bubbles/100/000000/linkedin.png\" title=\"LinkedIn\">](https://linkedin.com/in/yunus-ayd%C4%B1n-b9b01a18a/) [<img target=\"_blank\" src=\"https://img.icons8.com/bubbles/100/000000/github.png\" title=\"Github\">](https://github.com/aydinnyunus/WhatsappBOT) [<img target=\"_blank\" src=\"https://img.icons8.com/bubbles/100/000000/instagram-new.png\" title=\"Instagram\">](https://instagram.com/aydinyunus_/) [<img target=\"_blank\" src=\"https://img.icons8.com/bubbles/100/000000/twitter-squared.png\" title=\"LinkedIn\">](https://twitter.com/aydinnyunuss)\n"
  },
  {
    "path": "Take Photo.py",
    "content": "import cv2\n\ncam = cv2.VideoCapture(-1)\n\ncv2.namedWindow(\"test\")\n\nimg_counter = 0\n\nwhile True:\n    ret, frame = cam.read()\n    cv2.imshow(\"test\", frame)\n    if not ret:\n        break\n    k = cv2.waitKey(1)\n\n    if k%256 == 27:\n        # ESC pressed\n        print(\"Escape hit, closing...\")\n        break\n    elif k%256 == 32:\n        # SPACE pressed\n        img_name = \"opencv_frame_{}.png\".format(img_counter)\n        cv2.imwrite(img_name, frame)\n        print(\"{} written!\".format(img_name))\n        img_counter += 1\n\ncam.release()\n\ncv2.destroyAllWindows()\n"
  }
]