Proxmark3 community

Research, development and trades concerning the powerful Proxmark3 device.

Remember; sharing is caring. Bring something back to the community.


"Learn the tools of the trade the hard way." +Fravia

You are not logged in.

Announcement

Time changes and with it the technology
Proxmark3 @ discord

Users of this forum, please be aware that information stored on this site is not private.

#1 2010-10-02 18:53:30

mb300sd
Member
Registered: 2010-09-19
Posts: 6

Encoding T5557/T5567 with HID Data

Has anyone successfully used the "lf cmdread" function on the proxmark to encode a T5567 with data from a HID card? I seem to be writing to the card because I changed the modulation format, but I cannot get the correct data to come out. I'm trying to write the example data from http://www.proxclone.com/pdfs/HID_format_example.pdf into the card, but it is still not responding to the HID reader.

Here is a small program I wrote to do the encoding, the output is identical to the above PDF. Just paste in the output of "lf hid fskdemod"
http://mb300sd.net/random/HID_T5567_Encoder.exe

Last edited by mb300sd (2010-10-02 19:00:17)

Offline

#2 2010-10-07 09:40:59

rule
Member
Registered: 2008-05-21
Posts: 417

Re: Encoding T5557/T5567 with HID Data

Are you willing to share your source-code with the community?

Offline

#3 2011-02-09 06:04:08

mb300sd
Member
Registered: 2010-09-19
Posts: 6

Re: Encoding T5557/T5567 with HID Data

Has anyone gotten it to work? I can't get it to encode at all...




anyways, heres the code... create a C# windows forms project and replace the 2 files,

Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Numerics;

namespace HID_T5567_Encoder
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
      UInt16[] inBlocks = new UInt16[3];
      UInt32[] outBlocks = new UInt32[4];
      outBlocks[0] = 0x00107060;
      
      BigInteger input = new BigInteger(StringToByteArray(textBox1.Text.Trim()));
      for (int i = 2; i >= 0; i--)
      {
        inBlocks[i] = (UInt16)(input & (new BigInteger(0xFFFF)));
        input = input >> 16;
      }

      string[] bits = new string[4];
      bits[0] = "00000000000100000111000001100000";

      for (int i = 0; i < 3; i++)
      {
        bits[i+1] = "";
        for (int j = 15; j >= 0; j--)
        {
          if (GetBit(inBlocks[i], j))
            bits[i + 1] += 1;
          else
            bits[i + 1] += 0;
        }
        
        string tmp = "";
        for (int k = 0; k < bits[i + 1].Length; k++)
        {
          if (bits[i + 1][k] == '0')
            tmp += "01";
          else
            tmp += "10";
        }
        bits[i + 1] = tmp;
      }
      bits[1] = "00011101" + bits[1].Substring(8);

      string s = "";
      for (int i = 0; i < bits.Length; i++)
      {
        s += "Block " + i + ": " + bits[i] + "\n";
      }
      MessageBox.Show(s);
    }

    public static bool GetBit(UInt16 data, int bit)
    {
      return ((data >> bit) & 0x01) == 1;
    }

    public static byte[] StringToByteArray(String hex)
    {
      int NumberChars = hex.Length;
      byte[] bytes = new byte[(NumberChars / 2) + 1];
      bytes[(NumberChars / 2)] = 0;
      for (int i = NumberChars - 2 ; i >= 0; i -= 2)
        bytes[((NumberChars - i) / 2) - 1] = Convert.ToByte(hex.Substring(i, 2), 16);
      return bytes;
    }
  }
}


Form1.Designer.cs

namespace HID_T5567_Encoder
{
  partial class Form1
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
      if (disposing && (components != null))
      {
        components.Dispose();
      }
      base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      this.button1 = new System.Windows.Forms.Button();
      this.textBox1 = new System.Windows.Forms.TextBox();
      this.SuspendLayout();
      // 
      // button1
      // 
      this.button1.Location = new System.Drawing.Point(197, 10);
      this.button1.Name = "button1";
      this.button1.Size = new System.Drawing.Size(75, 23);
      this.button1.TabIndex = 0;
      this.button1.Text = "Encode";
      this.button1.UseVisualStyleBackColor = true;
      this.button1.Click += new System.EventHandler(this.button1_Click);
      // 
      // textBox1
      // 
      this.textBox1.Location = new System.Drawing.Point(12, 12);
      this.textBox1.Name = "textBox1";
      this.textBox1.Size = new System.Drawing.Size(179, 20);
      this.textBox1.TabIndex = 1;
      // 
      // Form1
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(284, 44);
      this.Controls.Add(this.textBox1);
      this.Controls.Add(this.button1);
      this.Name = "Form1";
      this.Text = "Form1";
      this.ResumeLayout(false);
      this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.TextBox textBox1;
  }
}

Offline

Board footer

Powered by FluxBB