Skip to content

Commit 0b8b0ff

Browse files
author
NullCipher99
committed
Initial commit
1 parent a3d2e8b commit 0b8b0ff

File tree

6 files changed

+175
-366
lines changed

6 files changed

+175
-366
lines changed

README.md

+27-29
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
11
# Hacker Space
22

3-
Welcome to Hacker Space, a platform designed for aspiring hackers to practice and learn various hacking techniques in a safe and controlled environment.
3+
Welcome to **Hacker Space**, a platform designed for aspiring hackers to practice and learn various hacking techniques in a safe and controlled environment.
44

55
![Hacker Space](https://img.shields.io/badge/Hacker%20Space-Online-brightgreen)
66

7-
## Description
8-
9-
Hacker Space provides an interactive learning experience where users can explore different commands, learn about cybersecurity, and even search GitHub accounts. Whether you're a beginner or an experienced hacker, Hacker Space offers resources and tools to enhance your skills.
10-
11-
## Features
12-
13-
- **Terminal Interface:** Practice hacking techniques in a simulated terminal environment.
14-
- **Command Reference:** Access a list of available commands and their descriptions.
15-
- **About Section:** Learn more about Hacker Space and its mission.
16-
- **GitHub Search:** Search for GitHub accounts directly from the website.
17-
187
## Website
198

20-
Explore Hacker Space at [https://jusot99.github.io/hacker-space/](https://jusot99.github.io/hacker-space/).
21-
22-
## Usage
9+
Explore **Hacker Space** at [https://jusot99.github.io/hacker-space/](https://jusot99.github.io/hacker-space/).
2310

24-
1. Navigate to the website using the provided link.
25-
2. Explore the different sections:
26-
- Home: Overview of Hacker Space.
27-
- About: Information about the platform.
28-
- Commands: List of available commands.
29-
3. Use the terminal interface to practice commands or search GitHub accounts.
30-
31-
## Contributing
32-
33-
Contributions are welcome! If you'd like to contribute to Hacker Space, feel free to submit a pull request with your improvements or suggestions.
34-
35-
## License
11+
---
3612

37-
This project is licensed under the [MIT License](LICENSE).
13+
### Features:
14+
- **GitHub Search**: Find user information, repositories, commits, issues, and more.
15+
- **Google Dorking**: Search Google for vulnerabilities and other critical information.
16+
- **Geolocation**: Displays the user's current location and country.
17+
- **Terminal Feel**: A fully responsive terminal-style interface.
3818

3919
---
4020

41-
© 2024 Hacker Space
21+
### Commands:
22+
```bash
23+
$ github user <username> # Fetch information about a GitHub user
24+
$ github repo <repo-name> # Search for GitHub repositories
25+
$ github commit <keyword> # Search for commits
26+
$ github issue <keyword> # Search for issues or pull requests
27+
$ google dork <query> # Perform Google dorking search
28+
$ ls # List directories
29+
$ pwd # Show the current directory
30+
$ clear # Clear the terminal
31+
$ whoami # Show the current user
32+
$ about # Go to your GitHub portfolio
33+
```
34+
35+
### How to use:
36+
1. Clone the repository or download the code.
37+
2. Open `index.html` in a browser to start interacting with the terminal.
38+
39+
Enjoy hacking! 🔥

about.html

-30
This file was deleted.

commands.html

-35
This file was deleted.

index.html

+10-26
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,17 @@
77
<link rel="stylesheet" href="styles.css">
88
</head>
99
<body>
10-
<div class="container">
11-
<header>
12-
<h1>Hacker Portal</h1>
13-
<nav>
14-
<a href="index.html">Home</a>
15-
<a href="about.html">About</a>
16-
<a href="commands.html">Commands</a>
17-
</nav>
18-
</header>
19-
<main>
20-
<div class="terminal">
21-
<div id="terminal-content"></div>
22-
<input type="text" id="terminal-input" autofocus>
23-
</div>
24-
<div class="search-section">
25-
<h2>Search GitHub Account</h2>
26-
<form id="search-form">
27-
<input type="text" id="search-input" placeholder="Enter GitHub username or email" required>
28-
<button type="submit">Search</button>
29-
</form>
30-
<div id="search-results"></div>
31-
</div>
32-
</main>
33-
<footer>
34-
<p>© 2024 Hacker Portal</p>
35-
</footer>
10+
11+
<div id="terminal">
12+
<div id="output">
13+
<p>Welcome to <span class="green">CyberTerminal</span>. Type <span class="yellow">help</span> to get started.</p>
14+
</div>
15+
<div class="input-line">
16+
<span class="prompt">guest@cyber:~$</span>
17+
<input type="text" id="command-input" autofocus>
18+
</div>
3619
</div>
20+
3721
<script src="script.js"></script>
3822
</body>
3923
</html>

script.js

+105-81
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,124 @@
1-
document.addEventListener('DOMContentLoaded', () => {
2-
const terminalInput = document.getElementById('terminal-input');
3-
const terminalContent = document.getElementById('terminal-content');
4-
const searchForm = document.getElementById('search-form');
5-
const searchInput = document.getElementById('search-input');
6-
const searchResults = document.getElementById('search-results');
1+
document.addEventListener("DOMContentLoaded", function () {
2+
const commandInput = document.getElementById("command-input");
3+
const output = document.getElementById("output");
74

8-
terminalInput.addEventListener('keypress', (e) => {
9-
if (e.key === 'Enter') {
10-
const command = terminalInput.value.trim();
5+
// Fetch user's location and country via Geolocation API
6+
function getUserLocation() {
7+
if (navigator.geolocation) {
8+
navigator.geolocation.getCurrentPosition(function (position) {
9+
const latitude = position.coords.latitude;
10+
const longitude = position.coords.longitude;
11+
12+
// Use reverse geocoding API to fetch country name
13+
fetch(`https://api.bigdatacloud.net/data/reverse-geocode-client?latitude=${latitude}&longitude=${longitude}&localityLanguage=en`)
14+
.then(response => response.json())
15+
.then(data => {
16+
printOutput(`Your location: ${data.city || "Unknown City"}, ${data.countryName}`);
17+
})
18+
.catch(error => {
19+
printOutput(`<span class="red">Could not fetch location.</span>`);
20+
});
21+
});
22+
} else {
23+
printOutput(`<span class="red">Geolocation is not supported by this browser.</span>`);
24+
}
25+
}
26+
27+
getUserLocation();
28+
29+
commandInput.addEventListener("keypress", function (event) {
30+
if (event.key === "Enter") {
31+
event.preventDefault();
32+
const command = commandInput.value.trim();
1133
executeCommand(command);
12-
terminalInput.value = '';
34+
commandInput.value = "";
1335
}
1436
});
1537

1638
function executeCommand(command) {
17-
if (command) {
18-
const commandElement = document.createElement('div');
19-
commandElement.textContent = `> ${command}`;
20-
terminalContent.appendChild(commandElement);
21-
22-
// Simulate response
23-
const responseElement = document.createElement('div');
24-
responseElement.textContent = getResponseForCommand(command);
25-
terminalContent.appendChild(responseElement);
39+
printOutput(`<span class="prompt">guest@cyber-linux:~$</span> ${command}`);
2640

27-
terminalContent.scrollTop = terminalContent.scrollHeight;
41+
if (command === "help") {
42+
printOutput(`
43+
Available commands:
44+
- github user <username> (Find GitHub user)
45+
- github repo <repo-name> (Find repositories)
46+
- github commit <keyword> (Search commits)
47+
- github issue <keyword> (Find issues/pull requests)
48+
- github code <keyword> (Search code)
49+
- github org <org-name> (Find organizations)
50+
- google dork <dork> (Google dorking search)
51+
- ls (List directories)
52+
- pwd (Show current path)
53+
- whoami (Show user)
54+
- clear (Clear terminal)
55+
- about (Go to GitHub portfolio)
56+
`);
57+
} else if (command.startsWith("github user ")) {
58+
fetchGitHubUser(command.split(" ")[2]);
59+
} else if (command.startsWith("github repo ")) {
60+
fetchGitHubRepo(command.split(" ")[2]);
61+
} else if (command.startsWith("google dork ")) {
62+
googleDork(command.substring(13));
63+
} else if (command === "about") {
64+
window.location.href = "https://github.com/jusot99";
65+
} else if (command === "clear") {
66+
output.innerHTML = "";
67+
} else if (command === "ls") {
68+
printOutput("Documents Downloads Pictures Projects CyberLinux");
69+
} else if (command === "pwd") {
70+
printOutput("/home/guest");
71+
} else if (command === "whoami") {
72+
printOutput("guest");
73+
} else {
74+
printOutput(`<span class="red">${command}: command not found.</span>`);
2875
}
2976
}
3077

31-
function getResponseForCommand(command) {
32-
switch (command.toLowerCase()) {
33-
case 'help':
34-
return 'Available commands: help, about, clear';
35-
case 'about':
36-
return 'Hacker Portal - The Ultimate Hacker Experience';
37-
case 'clear':
38-
terminalContent.innerHTML = '';
39-
return '';
40-
default:
41-
return `Command not found: ${command}`;
42-
}
78+
function fetchGitHubUser(username) {
79+
fetch(`https://api.github.com/users/${username}`)
80+
.then(response => response.json())
81+
.then(data => {
82+
if (data.message === "Not Found") {
83+
printOutput(`<span class="red">User '${username}' not found.</span>`);
84+
return;
85+
}
86+
printOutput(`
87+
<div><img src="${data.avatar_url}" class="avatar" alt="Avatar">Username: ${data.login}</div>
88+
<div>Name: ${data.name || "N/A"}</div>
89+
<div>Bio: ${data.bio || "No bio available"}</div>
90+
<div>Location: ${data.location || "N/A"}</div>
91+
<div>Followers: ${data.followers}</div>
92+
<div>Following: ${data.following}</div>
93+
<div>Repositories: ${data.public_repos}</div>
94+
<div>Profile: <a href="${data.html_url}" target="_blank">${data.html_url}</a></div>
95+
`);
96+
});
4397
}
4498

45-
searchForm.addEventListener('submit', (e) => {
46-
e.preventDefault();
47-
const query = searchInput.value.trim();
48-
if (query) {
49-
searchGitHub(query);
50-
}
51-
});
52-
53-
function searchGitHub(query) {
54-
fetch(`https://api.github.com/search/users?q=${query}`)
99+
function fetchGitHubRepo(repo) {
100+
fetch(`https://api.github.com/search/repositories?q=${repo}`)
55101
.then(response => response.json())
56102
.then(data => {
57-
displaySearchResults(data.items);
58-
})
59-
.catch(error => {
60-
console.error('Error fetching GitHub users:', error);
61-
searchResults.innerHTML = '<p>Error fetching GitHub users.</p>';
103+
if (data.items.length === 0) {
104+
printOutput(`<span class="red">No repositories found for '${repo}'.</span>`);
105+
return;
106+
}
107+
printOutput(`
108+
<div>Repositories found: ${data.items.length}</div>
109+
<div>First Repo: <a href="${data.items[0].html_url}" target="_blank">${data.items[0].full_name}</a></div>
110+
`);
62111
});
63112
}
64113

65-
function displaySearchResults(users) {
66-
searchResults.innerHTML = '';
67-
if (users.length === 0) {
68-
searchResults.innerHTML = '<p>No users found.</p>';
69-
} else {
70-
users.forEach(user => {
71-
fetch(user.url)
72-
.then(response => response.json())
73-
.then(userData => {
74-
const userName = userData.name ? userData.name : 'N/A';
75-
const userBio = userData.bio ? `<p>${userData.bio}</p>` : '';
76-
const userCard = `
77-
<div class="card">
78-
<div>
79-
<a href="${userData.html_url}" target="_blank">
80-
<img src="${userData.avatar_url}" alt="${userData.name}" class="avatar">
81-
</a>
82-
</div>
83-
<div class="user-info">
84-
<h2>${userData.login}</h2>
85-
<h3>${userName}</h3>
86-
${userBio}
87-
<ul>
88-
<li>${userData.followers} <strong>Followers</strong></li>
89-
<li>${userData.following} <strong>Following</strong></li>
90-
<li>${userData.public_repos} <strong>Repos</strong></li>
91-
</ul>
92-
</div>
93-
</div>
94-
`;
95-
searchResults.innerHTML += userCard;
96-
});
97-
});
98-
}
114+
function googleDork(query) {
115+
const googleSearch = `https://www.google.com/search?q=${encodeURIComponent(query)}`;
116+
printOutput(`Searching Google Dork: ${query}\n[Click here]( ${googleSearch} )`);
117+
window.open(googleSearch, "_blank");
118+
}
119+
120+
function printOutput(text) {
121+
output.innerHTML += `<p>${text}</p>`;
122+
output.scrollTop = output.scrollHeight;
99123
}
100124
});

0 commit comments

Comments
 (0)