diff --git a/main.js b/main.js index f1f3185..beb99fd 100644 --- a/main.js +++ b/main.js @@ -1,4 +1,5 @@ -const { app, BrowserWindow, Menu } = require('electron') +const { app, BrowserWindow, Menu } = require('electron'); +const { settings } = require('cluster'); let win; @@ -10,11 +11,14 @@ function createWindow () { backgroundColor: '#ffffff', resizable: false, titleBarStyle: 'hidden', - //icon: `file://${__dirname}/dist/offpass-electron/assets/logo.png` + //icon: `file://${__dirname}/dist/offpass-electron/assets/logo.png` }) + + Menu.setApplicationMenu(null) win.loadURL(`file://${__dirname}/dist/offpass-electron/index.html`) + //set.loadURL(`file://${__dirname}/dist/ofpass-electron/settinds`) //// uncomment below to open the DevTools. // win.webContents.openDevTools() diff --git a/package-lock.json b/package-lock.json index 67fc1f8..b221189 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1997,6 +1997,24 @@ "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", "dev": true }, + "@zxing/library": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/@zxing/library/-/library-0.15.2.tgz", + "integrity": "sha512-J+N88Eyg6eI2SKIk2YIkjjNICbMSqmLZnB3oD1S21Bi3k+Ddg2eKe/nW+Hce4NKAFAZtY1mdDM08Bj9eu87HSg==", + "requires": { + "text-encoding": "^0.7.0", + "ts-custom-error": "^3.0.0" + } + }, + "@zxing/ngx-scanner": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@zxing/ngx-scanner/-/ngx-scanner-3.0.0.tgz", + "integrity": "sha512-WK3VwklpGp2zBhZdBIUETO9igk5fOOvLUZpTjk2LDsqAxAhdNYbtOQVYJGSwSsF3evP8sKPxmyNlW3FF9vr7yQ==", + "requires": { + "@zxing/library": "^0.15.1", + "tslib": "^1.9.0" + } + }, "JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", @@ -12305,6 +12323,12 @@ } } }, + "text-encoding": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.7.0.tgz", + "integrity": "sha512-oJQ3f1hrOnbRLOcwKz0Liq2IcrvDeZRHXhd9RgLrsT+DjWY/nty1Hi7v3dtkaEYbPYe0mUoOfzRrMwfXXwgPUA==", + "optional": true + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -12447,6 +12471,11 @@ "utf8-byte-length": "^1.0.1" } }, + "ts-custom-error": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.1.1.tgz", + "integrity": "sha512-f/syoy+pTE4z82qaiRuthEeZtCGNKzlfs0Zc8jpQFcz/CYMaFSwFSdfFt1sSFnPlDLOEm7RCROdIxZ44N8UlwA==" + }, "ts-node": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.3.0.tgz", diff --git a/package.json b/package.json index c83eaab..0d4de0e 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@angular/platform-browser": "~9.1.11", "@angular/platform-browser-dynamic": "~9.1.11", "@angular/router": "~9.1.11", + "@zxing/ngx-scanner": "^3.0.0", "rxjs": "~6.5.4", "tslib": "^1.10.0", "zone.js": "~0.10.2" diff --git a/src/app/addpass/addpass.component.html b/src/app/addpass/addpass.component.html new file mode 100644 index 0000000..e819d01 --- /dev/null +++ b/src/app/addpass/addpass.component.html @@ -0,0 +1 @@ +

addpass works!

diff --git a/src/app/addpass/addpass.component.scss b/src/app/addpass/addpass.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/addpass/addpass.component.spec.ts b/src/app/addpass/addpass.component.spec.ts new file mode 100644 index 0000000..fbb9c79 --- /dev/null +++ b/src/app/addpass/addpass.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddpassComponent } from './addpass.component'; + +describe('AddpassComponent', () => { + let component: AddpassComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AddpassComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AddpassComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/addpass/addpass.component.ts b/src/app/addpass/addpass.component.ts new file mode 100644 index 0000000..3be76fe --- /dev/null +++ b/src/app/addpass/addpass.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-addpass', + templateUrl: './addpass.component.html', + styleUrls: ['./addpass.component.scss'] +}) +export class AddpassComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/app.component.html b/src/app/app.component.html index a381223..90c6b64 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,22 +1 @@ -
-
-
- - -
-

Click to scan

-
-

Alpha

- -
- -

New

-
-
- -

Settings

-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/app/app.component.scss b/src/app/app.component.scss index 2589a79..e69de29 100644 --- a/src/app/app.component.scss +++ b/src/app/app.component.scss @@ -1,147 +0,0 @@ -@import url('https://fonts.googleapis.com/css2?family=Righteous&display=swap'); -@import url('https://fonts.googleapis.com/css2?family=Righteous&family=Roboto&display=swap'); -//* Pictures *\\ -.bg{ - position: absolute; - left: 0; - top: 0; - z-index: -1; - -} -.logo{ - position: absolute; - width: 280px; - height: 280px; - left: 267px; - top: -30px; -} -.donate-img{ - position: absolute; - left: 38%; - right: 57%; - top: 56.17%; - bottom: 37.5%; -} -.new-img{ - position: absolute; - left: 48.25%; - right: 46.12%; - top: 55.17%; - bottom: 37.5%; -} -.settings-img{ - position: absolute; - width: 43.85px; - height: 43.85px; - left: 476px; - top: 320px; -} -//*Divs colors*\\ -.red{ - position: absolute; - width: 322.63px; - height: 848.08px; - padding-top: 300px; - - background: #FF2A2A; - transform: rotate(110.24deg); -} -.black{ - position: absolute; - width: 444.58px; - height: 839.77px; - padding-top: 800px; - - background: #1C1C1C; - transform: rotate(-114.86deg); -} - -//* Texte *\\ -.alpha{ - position: absolute; - padding-top: 500px; - padding-left: 700px; - - font-family: 'Righteous', cursive; - font-style: normal; - font-weight: normal; - font-size: 24px; - line-height: 30px; - letter-spacing: 0.13em; - - color: white; -} -.scan{ - position: absolute; - bottom: -11px; - left: 42px; - - font-family: 'Roboto', sans-serif; - font-style: normal; - font-weight: normal; - font-size: 24px; - line-height: 28px; - - color: white; -} -.donate-text{ - position: absolute; - width: 45px; - height: 16px; - left: 304px; - top: 370px; - - font-family: 'Roboto', sans-serif; - font-style: normal; - font-weight: normal; - font-size: 16px; - line-height: 16px; - - color: #1C1C1C; -} - -.new-text{ - position: absolute; - width: 28px; - height: 16px; - left: 393px; - top: 370px; - - font-family: 'Roboto', sans-serif; - font-style: normal; - font-weight: normal; - font-size: 16px; - line-height: 16px; - - color: #1C1C1C; -} -.settings-text{ - position: absolute; - width: 52px; - height: 16px; - left: 468px; - top: 370px; - - font-family: 'Roboto', sans-serif; - font-style: normal; - font-weight: normal; - font-size: 16px; - line-height: 16px; -} -//* Buttons *\\ - -.button1{ - position: absolute; - left: 37.25%; - right: 35%; - top: 40.5%; - bottom: 50.83%; - - background: #1C1C1C; - mix-blend-mode: normal; - border-radius: 4px; -} - - - - diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 2c3ba29..d72844e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -3,14 +3,35 @@ import { NgModule } from '@angular/core'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; +import { AddpassComponent } from './addpass/addpass.component'; +import { SettingsComponent } from './settings/settings.component'; +import { ScanComponent } from './scan/scan.component'; +import { DonateComponent } from './donate/donate.component'; +import { Routes, RouterModule } from '@angular/router'; +import { HomeComponent } from './home/home.component'; +import { ZXingScannerModule } from '@zxing/ngx-scanner'; +const routes: Routes = [ + { path: '', component: HomeComponent}, + { path: 'settings', component: SettingsComponent }, + { path: 'donate', component: DonateComponent }, + { path: 'scan', component: ScanComponent }, + { path: 'addpass', component: AddpassComponent } +]; @NgModule({ declarations: [ - AppComponent + AppComponent, + AddpassComponent, + SettingsComponent, + ScanComponent, + DonateComponent, + HomeComponent ], imports: [ + RouterModule.forRoot(routes), BrowserModule, - AppRoutingModule + AppRoutingModule, + ZXingScannerModule ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/donate/donate.component.html b/src/app/donate/donate.component.html new file mode 100644 index 0000000..93acc0d --- /dev/null +++ b/src/app/donate/donate.component.html @@ -0,0 +1 @@ +

donate works!

diff --git a/src/app/donate/donate.component.scss b/src/app/donate/donate.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/donate/donate.component.spec.ts b/src/app/donate/donate.component.spec.ts new file mode 100644 index 0000000..295968e --- /dev/null +++ b/src/app/donate/donate.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DonateComponent } from './donate.component'; + +describe('DonateComponent', () => { + let component: DonateComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DonateComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DonateComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/donate/donate.component.ts b/src/app/donate/donate.component.ts new file mode 100644 index 0000000..a920f65 --- /dev/null +++ b/src/app/donate/donate.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-donate', + templateUrl: './donate.component.html', + styleUrls: ['./donate.component.scss'] +}) +export class DonateComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html new file mode 100644 index 0000000..6494ebf --- /dev/null +++ b/src/app/home/home.component.html @@ -0,0 +1,29 @@ +
+
+
+ + + +
+

Click to scan

+
+
+ + + + +
+ +

New

+
+
+ +
+ +

Settings

+
+
+
diff --git a/src/app/home/home.component.scss b/src/app/home/home.component.scss new file mode 100644 index 0000000..eb4639f --- /dev/null +++ b/src/app/home/home.component.scss @@ -0,0 +1,134 @@ +@import url('https://fonts.googleapis.com/css2?family=Righteous&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Righteous&family=Roboto&display=swap'); +//* Pictures *\\ +.bg{ + position: absolute; + left: 0; + top: 0; + z-index: -1; + +} +.logo{ + position: absolute; + width: 280px; + height: 280px; + left: 267px; + top: -30px; +} +.donate-img{ + position: absolute; + left: 38%; + right: 57%; + top: 56.17%; + bottom: 37.5%; +} +.new-img{ + position: absolute; + left: 48.25%; + right: 46.12%; + top: 55.17%; + bottom: 37.5%; +} +.settings-img{ + position: absolute; + width: 43.85px; + height: 43.85px; + left: 476px; + top: 333px; +} +//*Divs colors*\\ +.red{ + position: absolute; + width: 322.63px; + height: 848.08px; + padding-top: 300px; + + background: #FF2A2A; + transform: rotate(110.24deg); +} +.black{ + position: absolute; + width: 444.58px; + height: 839.77px; + padding-top: 800px; + + background: #1C1C1C; + transform: rotate(-114.86deg); +} + +//* Texte *\\ + +.scan{ + position: absolute; + bottom: -11px; + left: 42px; + + font-family: 'Roboto', sans-serif; + font-style: normal; + font-weight: normal; + font-size: 24px; + line-height: 28px; + + color: white; +} +.donate-text{ + position: absolute; + width: 45px; + height: 16px; + left: 304px; + top: 370px; + + font-family: 'Roboto', sans-serif; + font-style: normal; + font-weight: normal; + font-size: 16px; + line-height: 16px; + + color: #1C1C1C; +} + +.new-text{ + position: absolute; + width: 28px; + height: 16px; + left: 393px; + top: 370px; + + font-family: 'Roboto', sans-serif; + font-style: normal; + font-weight: normal; + font-size: 16px; + line-height: 16px; + + color: #1C1C1C; +} +.settings-text{ + position: absolute; + width: 52px; + height: 16px; + left: 468px; + top: 370px; + + font-family: 'Roboto', sans-serif; + font-style: normal; + font-weight: normal; + font-size: 16px; + line-height: 16px; +} +//* Buttons *\\ + +.button1{ + position: absolute; + left: 37.25%; + right: 35%; + top: 40.5%; + bottom: 50.83%; + + background: #1C1C1C; + mix-blend-mode: normal; + border-radius: 4px; +} + + + + diff --git a/src/app/home/home.component.spec.ts b/src/app/home/home.component.spec.ts new file mode 100644 index 0000000..490e81b --- /dev/null +++ b/src/app/home/home.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeComponent } from './home.component'; + +describe('HomeComponent', () => { + let component: HomeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HomeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts new file mode 100644 index 0000000..73acf06 --- /dev/null +++ b/src/app/home/home.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.scss'] +}) +export class HomeComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/scan/scan.component.html b/src/app/scan/scan.component.html new file mode 100644 index 0000000..cfeb0f2 --- /dev/null +++ b/src/app/scan/scan.component.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/app/scan/scan.component.scss b/src/app/scan/scan.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/scan/scan.component.spec.ts b/src/app/scan/scan.component.spec.ts new file mode 100644 index 0000000..6965109 --- /dev/null +++ b/src/app/scan/scan.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ScanComponent } from './scan.component'; + +describe('ScanComponent', () => { + let component: ScanComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ScanComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ScanComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/scan/scan.component.ts b/src/app/scan/scan.component.ts new file mode 100644 index 0000000..f73d12a --- /dev/null +++ b/src/app/scan/scan.component.ts @@ -0,0 +1,25 @@ +import { Component, ViewChild, ViewEncapsulation, OnInit } from '@angular/core'; +import { SchemaService } from '../schema.service'; + + +@Component({ + selector: 'app-scan', + templateUrl: './scan.component.html', + styleUrls: ['./scan.component.scss'] +}) +export class ScanComponent implements OnInit { + + constructor(private schema:SchemaService){ + + } + + ngOnInit() { + this.schema.decrypted_raw = "%JtuB4O9M42%Gitea|Nicolas|542superGoOD_pW&|klier.nicolas@protonmail.com|https://nicolasklier.de:3000|($vb)$O4|()What's your favorite series%Rick and morty|(2fa)otpauth://totp/OffPass%20Test?secret=d34gfkki5dkd5knifysrpgndd5xb2c7eddwki7ya4pvoisfa5c3ko5pv&issuer=Nicolas%20Klier" + this.schema.parse() + } + + scanSuccessHandler(scan) { + + console.log(scan) + } +} diff --git a/src/app/schema.service.spec.ts b/src/app/schema.service.spec.ts new file mode 100644 index 0000000..ceaff90 --- /dev/null +++ b/src/app/schema.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { SchemaService } from './schema.service'; + +describe('SshemaService', () => { + let service: SchemaService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(SchemaService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/schema.service.ts b/src/app/schema.service.ts new file mode 100644 index 0000000..b60653f --- /dev/null +++ b/src/app/schema.service.ts @@ -0,0 +1,133 @@ +import { Injectable } from '@angular/core'; +import { element } from 'protractor'; +import { parseSelectorToR3Selector } from '@angular/compiler/src/core'; + + + +export interface ICustom { + key: string; + value: string; +} + +export interface IFormat { + session_key?: string; + title: string; + username?: string; + password: string; + email?: string; + website_url?: URL | null; + custom?: Map; + question_awnser?: Map +} + +@Injectable({ + providedIn: 'root' +}) +export class SchemaService { + + raw: String = "" + decrypted_raw: String = "" + + // Parsed content + text: string = null; + format: IFormat = { + session_key: "", + title: "", + username: "", + password: "", + email: "", + website_url: null, + custom: new Map(), // All defined custom/optional fields + question_awnser: new Map() + }; + + isCompatible(): boolean { + return true; + + } + + decrypt() { + if (this.isCompatible) { + + } + + + } + + encrypt() { + + } + + parse() { + const parts = this.decrypted_raw.split('|') + + this.format.title = parts[0]; + + if (this.format.title.startsWith('%')) { + this.format.session_key = ""; + + for (let i = 1; i < this.format.title.length; i++) { + const char = this.format.title.charAt(i); + + if (char != '%') { + this.format.session_key += char; + + } else { + + break; + } + } + this.format.title = this.format.title.substr(this.format.session_key.length + 2, this.format.title.length) + + } + + this.format.username = parts[1] + this.format.password = parts[2] + this.format.email = parts[3] + this.format.website_url = new URL(parts[4]) + + for(let i = 5; i < parts.length; i++){ + const target_part = parts[i] + if(target_part.startsWith + "("){ + const key = target_part.substring(1, target_part.indexOf(")")) + const value = target_part.substring(target_part.indexOf(")") + 1, target_part.length) + //sec question + if(key == ""){ + const splitted = value.split("%") + this.format.question_awnser.set(splitted[0], splitted[1]) + } + this.format.custom.set(key, value) + } + } + + + console.log(this) + + + } + + build(data?: IFormat): string { + + if (data == undefined) data = this.format; + + let raw = ""; + if (data.session_key != undefined) { + raw += "%" + data.session_key + "%"; + } + + raw += data.title + "|"; + raw += data.username + "|"; + raw += data.password + "|"; + raw += data.email + "|"; + raw += data.website_url + "|"; + + if (data.custom != undefined) { + data.custom.forEach((value, key, map) => { + raw += `(${key})${value}|`; + }); + } + raw = raw.substr(0, raw.length - 1); + + return raw; + } +} diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html new file mode 100644 index 0000000..4ab2a41 --- /dev/null +++ b/src/app/settings/settings.component.html @@ -0,0 +1 @@ +

settings works!

diff --git a/src/app/settings/settings.component.scss b/src/app/settings/settings.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/settings/settings.component.spec.ts b/src/app/settings/settings.component.spec.ts new file mode 100644 index 0000000..91588f3 --- /dev/null +++ b/src/app/settings/settings.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SettingsComponent } from './settings.component'; + +describe('SettingsComponent', () => { + let component: SettingsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SettingsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SettingsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts new file mode 100644 index 0000000..232b5dd --- /dev/null +++ b/src/app/settings/settings.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-settings', + templateUrl: './settings.component.html', + styleUrls: ['./settings.component.scss'] +}) +export class SettingsComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +}