Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
- <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
- <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
- <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="description" content="">
- <meta name="author" content="">
- <title>Copy My Tag</title>
- <!-- Bootstrap Core CSS -->
- <link href="css/bootstrap.css" rel="stylesheet">
- <!-- Custom CSS -->
- <link rel="stylesheet" href="css/main.css">
- <link href="css/custom.css" rel="stylesheet">
- <link rel="stylesheet" href="./font-awesome/css/font-awesome.min.css">
- <script src="./bebas-neue.js"></script>
- <link rel="stylesheet" href="css/jquery-ui.css">
- <!-- Custom Fonts & Icons -->
- <link href='css/fontsgoogleapiscom_css_family=Open_Sans:400,700,600,800.css' rel='stylesheet' type='text/css'>
- <link rel="stylesheet" href="css/icomoon-social.css">
- <link rel="stylesheet" href="css/font-awesome.min.css">
- <script src="js/modernizr-2.6.2-respond-1.1.0.min.js"></script>
- <script src="js/jquery-1.9.1.min.js"></script>
- <script src="js/bootstrap.min.js"></script>
- <script src="js/jquery-ui.js"></script>
- <!-- Scrolling Nav JavaScript -->
- <script src="js/jquery.easing.min.js"></script>
- <script src="js/js.cookie.js"></script>
- <script src="js/spin.js"></script>
- <script>
- </script>
- <script src="js/base64js.min.js"></script>
- <script>
- actionTimeout = false
- scanCallback = false;
- pendingCall = null
- verifyCallback = false;
- readCallback = false
- feeShown = false
- copyCallback = false
- cgi = "./cgi/"
- APIaddress = "https://proxcloud.de/api"//location.host+':4000'
- serverCheckInterval = null
- processing = false
- proxmarkDevice = null
- packetCounter = 0
- pendingProxPackets = []
- pendingProxPacketsTimeout = null
- pendingPackets = {}
- function sendProxPacket(packet){
- if (packet.counter != undefined){
- wrapped = packet
- } else {
- wrapped = {"type":"proxReponse","data": packet, "counter":packetCounter}
- packetCounter++
- }
- wrapped.timeout = setTimeout(function (){
- sendProxPacket(wrapped)
- }, 2400)
- pendingProxPackets.push(wrapped)
- pendingPackets[wrapped.counter] = wrapped
- clearTimeout(pendingProxPacketsTimeout)
- pendingProxPacketsTimeout = setTimeout(function (){
- sendToServer(pendingProxPackets)
- pendingProxPackets = []
- }, 100)
- }
- function sendToServer(packet, callback){
- getFromServer()
- $.post(APIaddress+"?cookie="+Cookies.get('sessionid'), JSON.stringify({"packets":packet}), function (data) {
- getFromServer()
- if (callback){
- callback(data)
- }
- }
- ).fail(function (a,b,c,d){
- //alert(b)
- console.log(a)
- });
- }
- function informUser(data){
- if (data.responseType){
- if (data.responseType == 'foundCard' || data.responseType == 'searchFail'){
- if (scanCallback){
- scanCallback(data);
- scanCallback = false
- }
- }
- if (data.responseType == 'verifyResult' && verifyCallback){
- verifyCallback(data);
- verifyCallback = false
- }
- if (data.responseType == 'cardDump' && readCallback){
- readCallback(data)
- readCallback = false
- }
- if (data.responseType = 'copyResult' && copyCallback){
- copyCallback(data)
- copyCallback = false
- }
- }
- }
- function writeUSB(data){
- if (proxmarkDevice){
- console.log("writing to pm3 ")
- proxmarkDevice.claimInterface(1).then(() => {
- proxmarkDevice.controlTransferOut({
- requestType: 'class',
- recipient: 'interface',
- request: 34,
- value: 0x03,
- index: 0x00})
- .then(() => {
- readUSB(proxmarkDevice)
- })
- //cmd = new Uint16Array([0x0107,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00])
- tmp = new ArrayBuffer(packetSize)
- array = new Uint8Array(tmp)
- array.set(new Uint8Array(data.buffer))
- proxmarkDevice.transferOut(1, array)
- })
- }
- }
- usbSize = 64
- packetSize = 544
- buff = new ArrayBuffer(packetSize)
- currnetPacket = new Uint8Array(buff)
- byteCount = 0
- function readUSB(device){
- device.transferIn(2, usbSize)
- .then(result => {
- readUSB(device);
- if (result.status == 'ok'){
- currnetPacket.set(new Uint8Array(result.data.buffer), byteCount)
- byteCount = byteCount + result.data.byteLength
- if (byteCount >= packetSize) {
- /*str = ""
- view = new DataView(currnetPacket.buffer)
- for (i = 0; i < packetSize; i++){
- str = str+String.fromCharCode(view.getUint8(i))
- }*/
- //str = str.replace(/[^A-Za-z 0-9 \.,\?""!@#\$%\^&\*\(\)-_=\+;:<>\/\\\|\}\{\[\]`~]*/g, "");
- /*console.log(str)
- alert(str)*/
- console.log("read from pm3 ")
- sendProxPacket(base64js.fromByteArray(currnetPacket))
- byteCount = 0
- clearTimeout(actionTimeout)
- actionTimeout = setTimeout(showActionTimeoutError, 30000)
- }
- }
- })
- }
- function connectUSB(){
- var device;
- navigator.usb.requestDevice({ filters: [{ vendorId: 65021 }] })
- .then(selectedDevice => {
- device = selectedDevice;
- return device.open(); // Begin a session.
- })
- .then(() => device.selectConfiguration(1)) // Select configuration #1 for the device.
- .then(() => device.claimInterface(0))
- .then(() => {
- proxmarkDevice = device;
- $('#connectionStatus').css('color', 'green')
- $('#connectionStatus').html("Connected ✔")
- $('#connectButton').hide()
- })
- .catch(error => {
- console.log(error);
- });
- /*
- .then(() => device.controlTransferOut({
- requestType: 'vendor',
- recipient: 'device',
- request: 0x01,
- value: 0x05,
- index: 0x00})) // Ready to receive data , new Uint16Array([1,2,3])
- .then(result => {
- console.log(result);
- })*/
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- card = null;
- function doLogin(data){
- $('#loginForm').hide()
- $('#loginbanner').hide()
- $('#welcomeName').text(data.email)
- $('#wlecomebanner').show()
- $("#balance").text(data.balance)
- }
- waitingResponse = false
- function getFromServer(callback){
- if (!processing){
- clearInterval(serverCheckInterval)
- serverCheckInterval = null
- return
- }
- if (waitingResponse){
- return
- }
- waitingResponse = true
- pendingCall = $.ajax({
- type: "GET",
- url: APIaddress+"?cookie="+Cookies.get('sessionid'),
- dataType: "jsonp",
- success: function (data) {
- console.log('got pack from server '+data.type)
- if (data.type == 'packetAck'){
- console.log("acking"+data.counters)
- for (ack in data.counters){
- if(data.counters[ack]){
- if(pendingPackets[data.counters[ack]]){
- clearTimeout(pendingPackets[data.counters[ack]].timeout)
- }
- delete pendingPackets[data.counters[ack]]
- }
- }
- //return
- }
- waitingResponse = false
- if (data.status){
- if (data.status == 'notLoggedIn'){
- console.log("not looged into service...")
- return;
- }
- }
- if (data.type == 'proxCmd'){
- //console.log("got packget from server"+base64js.toByteArray(data.data))
- writeUSB(base64js.toByteArray(data.data))
- }
- if (data.type == 'userReponse'){
- //print "got packget from server"#, response
- informUser(data)
- }
- if (data.type == 'cardData'){
- saveCardData(data)
- }
- if (data.type == 'actionFinished'){
- processing = false;
- clearInterval(serverCheckInterval)
- serverCheckInterval = null
- }
- if (callback){
- callback()
- }
- getFromServer()
- },
- }).fail(function (a,b,c){
- waitingResponse = false
- if(b!='abort'){
- setTimeout(getFromServer, 1000)
- console.log('error: get request to server failed, trying again')
- }
- //$('#connectionStatus').html("Could not connect to client, are you sure it's running?")
- });
- }
- function scan(type, callback){
- scanCallback = callback;
- processing = true
- sendToServer([{
- "type":"userCmd",
- "cmd": "scan",
- "data":type
- }])
- }
- function verify(type, callback){
- verifyCallback = callback;
- processing = true
- sendToServer([{
- "type":"userCmd",
- "cmd": "verify",
- "id":type
- }])
- }
- function dump(type, callback){
- readCallback = callback;
- processing = true
- sendToServer([{
- "type":"userCmd",
- "cmd": "dump",
- "id":type,
- "skipFee": feeShown
- }])
- }
- function copy(id, callback){
- copyCallback = callback
- sendToServer([{
- "type":"userCmd",
- "cmd": "clone",
- "id":id
- }])
- }
- function snoop(id, callback){
- snoopCallback = callback
- sendToServer([{
- "type":"userCmd",
- "cmd": "snoop",
- "id":id
- }])
- }
- function login(){
- email = $('#username').val()
- pass = $('#password').val()
- $('#regStatus').hide()
- $('#loginForm').fadeTo(500, 0.2)
- $('#loginStatus').hide()
- $.post( cgi+"/login.py", { username: email, password:pass }, function( data ) {
- console.log( data );
- if (data.status){
- $.get(cgi+"/checkAccount.py", function(data){
- doLogin(data)
- })
- } else {
- $('#loginForm').fadeTo(500, 1)
- $('#loginStatus').show()
- $('#loginStatus').text(data.result)
- }
- }, "json");
- return false
- }
- function register(){
- email = $('#username').val()
- pass = $('#password').val()
- $('#loginForm').fadeTo(500, 0.2)
- $('#loginStatus').hide()
- $.post( cgi+"/register.py", { username: email, password:pass }, function( data ) {
- console.log( data );
- if (data.status){
- $('#loginForm').fadeTo(500, 1)
- $('#regStatus').show()
- $('#regStatus').text(data.result)
- } else {
- $('#loginForm').fadeTo(500, 1)
- $('#loginStatus').show()
- $('#loginStatus').text(data.result)
- }
- }, "json");
- }
- function resetPassword(){
- email = $('#username').val()
- $('#loginForm').fadeTo(500, 0.2)
- $('#loginStatus').hide()
- $.post( cgi+"/resetPassword.py", { username: email}, function( data ) {
- console.log( data );
- if (data.status){
- $('#loginForm').fadeTo(500, 1)
- $('#regStatus').show()
- $('#regStatus').text(data.result)
- } else {
- $('#loginForm').fadeTo(500, 1)
- $('#loginStatus').show()
- $('#loginStatus').text(data.result)
- }
- }, "json");
- }
- function supportedVersion() {
- var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
- version = raw ? parseInt(raw[2], 10) : false;
- return version >= 61
- }
- function isChrome(){
- return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
- }
- function supportedBrowser(){
- return isChrome() && supportedVersion()
- }
- jQuery.fn.extend({
- disable: function(state) {
- return this.each(function() {
- this.disabled = state;
- if (state){
- $(this).parent().addClass('disabledButton')
- $(this).removeClass('active-button')
- } else {
- $(this).parent().removeClass('disabledButton')
- $(this).addClass('active-button')
- }
- });
- }
- });
- function restartServer(callback){
- waitingResponse = false;
- packetCounter = 0
- feeShown = false
- for (d in pendingPackets){
- clearTimeout(d)
- }
- pendingPackets = {}
- if(pendingCall){
- pendingCall.abort()
- }
- clearTimeout(pendingProxPacketsTimeout)
- $.ajax({
- type: "GET",
- url: APIaddress+"?restart=1.py",
- dataType: "jsonp",
- success: function (data) {
- console.log("restarted")
- waitingResponse = false;
- packetCounter = 0
- feeShown = false
- for (d in pendingPackets){
- clearTimeout(d)
- }
- pendingPackets = {}
- if(pendingCall){
- pendingCall.abort()
- }
- callback()
- },
- }).fail(function (){
- //waitingResponse = false
- //getFromServer()
- //$('#connectionStatus').html("Could not connect to client, are you sure it's running?")
- });
- }
- function startLoading(){
- var opts = {
- lines: 13 // The number of lines to draw
- , length: 28 // The length of each line
- , width: 14 // The line thickness
- , radius: 42 // The radius of the inner circle
- , scale: 1 // Scales overall size of the spinner
- , corners: 1 // Corner roundness (0..1)
- , color: '#000' // #rgb or #rrggbb or array of colors
- , opacity: 0 // Opacity of the lines
- , rotate: 0 // The rotation offset
- , direction: 1 // 1: clockwise, -1: counterclockwise
- , speed: 0.5 // Rounds per second
- , trail: 60 // Afterglow percentage
- , fps: 20 // Frames per second when using setTimeout() as a fallback for CSS
- , zIndex: 2e9 // The z-index (defaults to 2000000000)
- , className: 'spinner' // The CSS class to assign to the spinner
- , top: '50%' // Top position relative to parent
- , left: '50%' // Left position relative to parent
- , shadow: false // Whether to render a shadow
- , hwaccel: false // Whether to use hardware acceleration
- , position: 'absolute' // Element positioning
- }
- var target = document.getElementById('actionArea')
- var spinner = new Spinner(opts).spin(target);
- }
- function hideLoading(){
- $('#spinbackground').hide()
- $('.spinner').hide()
- clearTimeout(actionTimeout)
- }
- function showLoading(){
- clearTimeout(actionTimeout)
- actionTimeout = setTimeout(showActionTimeoutError, 30000)
- $('#spinbackground').show()
- $('.spinner').show()
- }
- function showActionTimeoutError(){
- $("#timeoutDialog").dialog('open')
- }
- function closeTimeoutDialog(){
- step(0)
- $("#timeoutDialog").dialog('close')
- }
- $( document ).ready(function() {
- startLoading()
- hideLoading();
- $.get(cgi+"/checkAccount.py", function(data){
- if(data.status){
- doLogin(data)
- } else {
- $('#loginForm').show()
- }
- })
- $("#timeoutDialog").dialog()
- $("#timeoutDialog").dialog('close')
- $('#loginButton').on('click', login)
- $('#registerButton').on('click', register)
- $('#passwordResetButton').on('click', resetPassword)
- if (!isChrome()){
- $('#browserwarning').html("You are using an unsupported browser. Please open this page using Google Chrome.")
- } else if (!supportedVersion()){
- $('#browserwarning').html("You are using an outdated version of Chrome, please update your browser to version 61 or later")
- } else {
- $('#browserwarning').hide()
- }
- disableSteps()
- $("#scanButton").disable(false)
- $("#dialog").dialog({width: Math.min(window.innerWidth, 800)})
- //$("#dialog").dialog( "option", "maxWidth", 800 );
- $("#dialog").dialog('close')
- $("#StatusDialog").dialog()
- $("#StatusDialog").dialog('close')
- $( document ).ready(function() {
- $('#copyrightYear').html((new Date()).getFullYear())
- });
- restartServer(hideLoading)
- });
- function stop(){
- return false
- }
- function disableSteps(){
- $("#verifyButton").disable(true)
- $("#readButton").disable(true)
- $("#copyButton").disable(true)
- $("#snoopButton").disable(true)
- $("#scanButton").disable(true)
- $("#saveButton").disable(true)
- }
- function step(stepID){
- showLoading()
- if (stepID == 0){
- $('#currentStep').html('Step 1 - Scan')
- $('#stepMessage').html('Click "Scan" to begin')
- disableSteps()
- $("#scanButton").disable(false)
- restartServer(hideLoading)
- } else if (stepID == 1){
- disableSteps()
- scan('all', function (data){
- hideLoading()
- if (data && data.responseType=="foundCard"){
- card = data.cards[0]['data']
- cards = ""
- canCopy = true
- for (c in data.cards){
- cards = cards + data.cards[c]['cardName']+' card, ID: '+data.cards[c]['data']['id'].toUpperCase()
- if(!data.cards[c]['canBeCopied']){
- cards = cards +" - <span style=\"color:red;\">This card can't currently be copied</span>"
- canCopy = false
- }
- cards = cards +"<br>"
- }
- $('#stepMessage').html('Found '+cards+'<br><br>Place the blank card on the Proxmark3 to check it is the right type')
- if (canCopy){
- $("#verifyButton").disable(false)
- $('#currentStep').html('Step 2 - Verify')
- } else {
- $('#currentStep').html('Step 1 - Scan')
- //$('#stepMessage').html('Click "Scan" to begin')
- }
- }
- if (data && data.responseType =="searchFail"){
- $("#scanButton").disable(false)
- card = false
- $('#stepMessage').html('Failed to find card<br><br>Try scanning again with the card in a different position')
- clearInterval(serverCheckInterval)
- serverCheckInterval = null
- }
- })
- } else if(stepID == 2){
- disableSteps()
- verify(card['id'], function(result){
- hideLoading()
- if (result['match']){
- fee = ""
- if (card['fee']){
- fee = "<br><br>Reading this card type requires a fee. Proceeding will deduct "+card['fee']+" from your account"
- }
- $('#stepMessage').html('✔ This is the right type of card! You can proceed to "Read"'+fee)
- $("#readButton").disable(false)
- $('#currentStep').html('Step 3 - Read')
- } else {
- if (result.userMessage){
- $('#stepMessage').html('✖ '+result.userMessage)
- } else {
- $('#stepMessage').html("✖ couldn't verify card, please try again")
- }
- $("#verifyButton").disable(false)
- }
- })
- } else if (stepID == 3){
- disableSteps()
- dump(card['id'], function(result){
- hideLoading()
- if (result['result']){
- $('#currentStep').html('Step 4 - Copy')
- $('#stepMessage').html('Card successfully read. Place blank card on the proxmark3 to copy')
- $("#copyButton").disable(false)
- $("#saveButton").disable(false)
- } else {
- if (result.reason == 'fee'){
- $('#stepMessage').html('✔ This is the right type of card! You can proceed to "Read"<br><span style="font-size:small">Reading this type of card requires a fee. Click "Read" again to proceed, proceeding will deduct 5€ from your account.</span>')
- feeShown = true
- } else {
- if (result.userMessage){
- $('#stepMessage').html('✖ '+result.userMessage)
- } else {
- $('#stepMessage').html('Error reading card, please try again')
- }
- }
- $("#readButton").disable(false)
- $("#saveButton").disable(false)
- }
- })
- } else if (stepID == 3.5){
- $('#stepMessage').html('In order to read this card, you need to place the proxmark3 between the card and a reader')
- } else if (stepID == 4){
- disableSteps()
- copy(card['id'], function(result){
- hideLoading()
- if (result['result']){
- $('#currentStep').html('Done')
- $("#saveButton").disable(false)
- $('#stepMessage').html('✔ Complete, card successfully copied')
- } else {
- $('#stepMessage').html('Copying failed, please try again')
- $("#copyButton").disable(false)
- }
- })
- }
- }
- function saveCard(){
- sendToServer([{
- "type":"userCmd",
- "cmd": "getCard",
- "cardID":card['id']
- }])
- }
- function saveCardData(data){
- if(data.card.data.join){
- data.card.data = data.card.data.join('')
- }
- $.post("./copymytag/save.py", data.card, function (data) {
- alert(data.result)
- }
- ).fail(function (a,b,c,d){
- //alert(b)
- console.log(a)
- });
- }
- </script>
- </head>
- <body>
- <header class="navbar navbar-inverse navbar-fixed-top" style= " height: 94px; background-color: white;" role="banner">
- <div class="container">
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="navbar-brand" href="index.html"><img style=" height: 90px;" src="img/logo.jpg" alt=""></a>
- </div>
- <div class="collapse navbar-collapse">
- <ul class="nav navbar-nav navbar-right">
- </ul>
- </div>
- </div>
- </header><!--/header-->
- <!-- Page Title -->
- <div class="section section-breadcrumbs">
- <div class="container">
- <div class="row">
- <div class="col-md-12">
- <h2 style="color:white">Control Panel</h2>
- <h4>You are logged in as <span id="welcomeName"></span></h4>
- </div>
- </div>
- </div>
- </div>
- <div class="section">
- <div class="container">
- <div class="row">
- <div class="col-sm-12">
- <h4 id="browserwarning" style="color:red"></h4>
- <h4 id="loginbanner">Login to start using the control panel</h4>
- <div id="wlecomebanner" style="display:none">
- <h5>Proxmark3 Status: <span id="connectionStatus" style="color: red;">Disconenctd ✘</span><span id='connectButton'> - <button onclick="connectUSB()">Connect Now</button></span></h5><br>
- <div id="actionArea">
- <div id=stepPanel style="/*margin-left: 8%;*/width: 81%;height: 200px;">
- <h3 style=" font-weight: bolder;" align="center" ><span id="currentStep">Step 1 - Scan</span></h3>
- <br><br>
- <h3 id="stepMessage" style="font-weight: bolder;" align="center" >Click "Scan" to begin</h3><br><br>
- </div>
- <ul style=" /* margin-left: -5%;*/list-style: none;" class="breadcrumbs-two">
- <li style="width:18%" ><button class="active-button" style="width:100%" id='scanButton' onclick="step(1)">Scan</button></li>
- <li style="width:18%"><button class="test active-button" style="width:100%" id='verifyButton' onclick="step(2)">Verify</button></li>
- <li style="width:18%"><button class="active-button" style="width:100%" id='readButton' onclick="step(3)">Read</button></li>
- <li style="width:18%"><button class="active-button" style="width:100%" id='copyButton' onclick="step(4)">Copy</button></li>
- <li style="width:18%"><button class="active-button" style="width:100%" id='saveButton' onclick="saveCard()">Save</button></li>
- </ul>
- <ul style=" display: none; margin-left: -5%;list-style: none;" class="breadcrumbs-two">
- <li style="width:18%" ><button style="width:100%; border: none; background: none;" disabled></button></li>
- <li style="width:18%"><button style="width:100%; border: none; background: none;" disabled></button></li>
- <li style="width:18%"><button style="width:100%; background-color: #ddd;" id='snoopButton' onclick="step(3.5)">Snoop</button></li>
- </ul>
- <br>
- </div>
- <br><br>
- <button style="width:20%; border: none; background: none;" disabled></button>
- <button style="width:10%; border: none; background: none;" disabled></button>
- <button class="back-button" style="width:20%;" id='snoopButton' onclick="step(0)">Restart</button>
- </div>
- <div id="loginStatus" style="margin:0px 0px 10px 0px;background-color: rgba(255, 0, 0, 0.36);"></div>
- <form id="loginForm" style="display:none;padding: 20px;box-shadow:none;" class="modal-content animate" action="login.php" onSubmit="return stop();">
- <div class="">
- <label><b>Email</b></label>
- <input style=" padding: 7px;border-radius: 6px;" id="username" type="text" placeholder="Enter email" name="username" required>
- <label><b>Password</b></label>
- <input style=" padding: 7px;border-radius: 6px;" id="password" type="password" placeholder="Enter Password" name="password" required>
- <button id="loginButton" style="margin-left:10px" type="submit">Login</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment