// 3. Select size if needed if (task.size) { await page.select('select[name="size"]', task.size); await page.waitForTimeout(randomDelay(200, 500)); }
module.exports = mongoose.model('Profile', ProfileSchema); const TaskSchema = new mongoose.Schema({ name: String, productUrl: String, profileId: { type: mongoose.Schema.Types.ObjectId, ref: 'Profile' }, maxPrice: Number, size: String, quantity: { type: Number, default: 1 }, status: { type: String, enum: ['idle', 'running', 'completed', 'failed'], default: 'idle' }, runs: { type: Number, default: 0 }, lastRun: Date, createdAt: { type: Date, default: Date.now } }); module.exports = mongoose.model('Task', TaskSchema); models/Log.js const LogSchema = new mongoose.Schema({ taskId: { type: mongoose.Schema.Types.ObjectId, ref: 'Task' }, message: String, type: { type: String, enum: ['info', 'success', 'error'] }, timestamp: { type: Date, default: Date.now } }); 4. Core Sniper Service services/sniper.js const puppeteer = require('puppeteer-extra'); const StealthPlugin = require('puppeteer-extra-plugin-stealth'); puppeteer.use(StealthPlugin()); const notifier = require('./notifier'); const Log = require('../models/Log'); const Profile = require('../models/Profile'); async function snipeTask(task) { const profile = await Profile.findById(task.profileId); if (!profile) throw new Error('Profile missing'); Zenohack.com Sniper
module.exports = { sendDiscord }; routes/api.js const express = require('express'); const router = express.Router(); const Task = require('../models/Task'); const Profile = require('../models/Profile'); const { snipeTask } = require('../services/sniper'); // Create sniper task router.post('/tasks', async (req, res) => { const task = await Task.create(req.body); res.json(task); }); Fill billing info await page
const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox'] }); const page = await browser.newPage(); Fill billing info await page.type('#fullName'
// 6. Fill billing info await page.type('#fullName', profile.billing.fullName); await page.type('#address', profile.billing.address); await page.type('#city', profile.billing.city); await page.type('#zip', profile.billing.zip); await page.type('#cardNumber', profile.billing.cardNumber); await page.type('#expiry', profile.billing.expiry); await page.type('#cvv', profile.billing.cvv);
// Get all tasks router.get('/tasks', async (req, res) => { const tasks = await Task.find().populate('profileId'); res.json(tasks); });