Skip to content

Commit

Permalink
Merge pull request #11 from itskdhere/cli
Browse files Browse the repository at this point in the history
Implement CLI
  • Loading branch information
itskdhere authored Aug 31, 2024
2 parents d54bd83 + 59eaa16 commit 47e4b1d
Show file tree
Hide file tree
Showing 40 changed files with 669 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
:root {
--side-gap: 0.5rem;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

* {
margin: 0;
padding: 0;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}
3 changes: 2 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { Routes, Route } from "react-router-dom";
import "./App.css";

import Home from "./pages/Home";
import Cli from "./pages/Cli";

function App() {
return (
<Routes>
<Route path="/" element={<Home />}></Route>
{/* <Route path="/cli" element={<Cli />}></Route> */}
<Route path="/cli" element={<Cli />}></Route>
</Routes>
);
}
Expand Down
119 changes: 119 additions & 0 deletions src/components/Commands/Cat.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import classes from "./Commands.module.css";

const Cat = (props) => {
let { fileName } = props;

Check failure on line 4 in src/components/Commands/Cat.jsx

View workflow job for this annotation

GitHub Actions / Lint

'fileName' is missing in props validation
fileName = fileName.trim();

Check failure on line 5 in src/components/Commands/Cat.jsx

View workflow job for this annotation

GitHub Actions / Lint

'fileName.trim' is missing in props validation
fileName.toLowerCase();

Check failure on line 6 in src/components/Commands/Cat.jsx

View workflow job for this annotation

GitHub Actions / Lint

'fileName.toLowerCase' is missing in props validation

switch (fileName) {
case "about":
return (
<div>
<h4 className={classes.description}>
Welcome to ZeroDay Alliance, SNU students passionate about
cybersecurity and ethical hacking. Here’s what you can expect:
</h4>
<ul className={classes.catList}>
<li>
<b>Learn:</b> Stay updated on zero-day vulnerabilities and the
latest security trends.
</li>
<li>
<b>Collaborate:</b> Work with peers on projects and challenges.
</li>
<li>
<b>Share:</b> Exchange resources, tips, and tools for ethical
hacking.
</li>
<li>
<b>Discuss:</b> Engage in conversations about cybersecurity news,
strategies, and innovations.
</li>
<li>
<b>Network:</b> Connect with future professionals in the field.
</li>
</ul>
</div>
);
case "events":
return (
<ul className={classes.catList}>
<li>Event 1</li>
<li>Event 2</li>
</ul>
);
case "teams":
return (
<ul className={classes.catList}>
<li>Team 1</li>
<li>Team 2</li>
<li>Team 3</li>
<li>Team 4</li>
</ul>
);
case "faq":
return <div>FAQ</div>;
case "contact":
return (
<ul className={classes.catList}>
<li>
<span>Website: </span>
<span>
<a
href="https://zeroday-alliance.pages.dev"
target="_blank"
rel="noopener noreferrer"
>
zeroday-alliance.pages.dev
</a>
</span>
</li>
<li>
<span>GitHub: </span>
<span>
<a
href="https://github.com/ZeroDay-Alliance-SNU"
target="_blank"
rel="noopener noreferrer"
>
@ZeroDay-Alliance-SNU
</a>
</span>
</li>
<li>
<span>LinkedIn: </span>
<span>
<a
href="https://www.linkedin.com/company/zeroday-alliance-snu"
target="_blank"
rel="noopener noreferrer"
>
@zeroday-alliance-snu
</a>
</span>
</li>
<li>
<span>Instagram: </span>
<span>
<a
href="https://www.instagram.com/zerodayalliance/"
target="_blank"
rel="noopener noreferrer"
>
@zerodayalliance
</a>
</span>
</li>
</ul>
);
case "":
setTimeout(() => {
window.open("https://takeb1nzyto.space", "_blank");
}, 420);
return <div>🐈</div>;
default:
return <div>{fileName}: No such file or directory</div>;
}
};

export default Cat;
7 changes: 7 additions & 0 deletions src/components/Commands/Commands.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.description {
padding-bottom: 5px;
}

.catList li {
list-style-position: inside;
}
7 changes: 7 additions & 0 deletions src/components/Commands/Echo.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const Echo = (props) => {
const { message } = props;

Check failure on line 2 in src/components/Commands/Echo.jsx

View workflow job for this annotation

GitHub Actions / Lint

'message' is missing in props validation

return <div>{message}</div>;
};

export default Echo;
22 changes: 22 additions & 0 deletions src/components/Commands/Help.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const Help = () => {
return (
<>
<span className="command">cat &lt;section&gt;</span> -{" "}
<span>print a section</span>
<br />
<span className="command">clear</span> - <span>clear the screen</span>
<br />
<span className="command">echo &lt;arg&gt;</span> -{" "}
<span>print arguments</span>
<br />
<span className="command">help</span> - <span>print this help</span>
<br />
<span className="command">ls</span> - <span>list all sections</span>
<br />
<span className="command">whoami</span> - <span>about us</span>
<br />
</>
);
};

export default Help;
13 changes: 13 additions & 0 deletions src/components/Commands/Ls.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { files } from "../../config/fs";

const Ls = () => {
return (
<>
{files.map((file, index) => (
<div key={index}>{file}</div>
))}
</>
);
};

export default Ls;
9 changes: 9 additions & 0 deletions src/components/Commands/Sudo.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const Sudo = () => {
setTimeout(() => {
window.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "_blank");
}, 420);

return <div>sudo: unable to change to root: Operation not permitted</div>;
};

export default Sudo;
12 changes: 12 additions & 0 deletions src/components/Commands/Whoami.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const Whoami = () => {
return (
<div>
<p>ZeroDay Alliance SNU</p>
<p>
Use <span className="command">cat about</span> for more info.
</p>
</div>
);
};

export default Whoami;
8 changes: 8 additions & 0 deletions src/components/Commands/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Cat from "./Cat";
import Echo from "./Echo";
import Help from "./Help";
import Ls from "./Ls";
import Sudo from "./Sudo";
import Whoami from "./Whoami";

export { Cat, Echo, Help, Ls, Sudo, Whoami };
16 changes: 16 additions & 0 deletions src/components/Prompt/Prompt.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { userName, hostName, defaultDir } from "../../config/PS1";
import "./Prompt.modules.css";

const Prompt = () => {
return (
<>
<span className="userName">{userName}</span>
<span className="at">@</span>
<span className="hostName">{hostName}</span>
<span className="colon"> : </span>
<span className="dirName">{defaultDir}</span>
</>
);
};

export default Prompt;
26 changes: 26 additions & 0 deletions src/components/Prompt/Prompt.modules.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.userName {
color: rgb(6, 197, 6);
/* text-shadow: 0px 0px 5px; */
}

.at {
color: rgb(4, 160, 207);
/* text-shadow: 0px 0px 5px; */
}

.hostName {
color: rgb(140, 197, 6);
/* text-shadow: 0px 0px 5px; */
}

.colon {
color: rgb(215, 215, 215);
/* text-shadow: 0px 0px 5px; */
}

.dirName {
font-size: larger;
font-weight: 900;
color: rgb(197, 6, 117);
/* text-shadow: 0px 0px 5px; */
}
3 changes: 3 additions & 0 deletions src/components/Prompt/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Prompt from "./Prompt";

export default Prompt;
9 changes: 9 additions & 0 deletions src/components/StdErr/StdErr.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import "./StdErr.modules.css";

const StdErr = (props) => {
const { stdErr } = props;

Check failure on line 4 in src/components/StdErr/StdErr.jsx

View workflow job for this annotation

GitHub Actions / Lint

'stdErr' is missing in props validation

return <div className="stdErr">{stdErr}</div>;
};

export default StdErr;
7 changes: 7 additions & 0 deletions src/components/StdErr/StdErr.modules.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.stdErr {
color: rgb(230, 40, 10);
/* text-shadow: 0px 0px 5px; */
margin-top: 5px;
margin-bottom: 15px;
margin-left: 15px;
}
3 changes: 3 additions & 0 deletions src/components/StdErr/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import StdErr from "./StdErr";

export default StdErr;
15 changes: 15 additions & 0 deletions src/components/StdIn/StdIn.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { inCharacter } from "../../config/PS1";
import "./StdIn.modules.css";

const StdIn = (props) => {
const { cmd } = props;

Check failure on line 5 in src/components/StdIn/StdIn.jsx

View workflow job for this annotation

GitHub Actions / Lint

'cmd' is missing in props validation

return (
<>
<span className="inCharacter">{inCharacter} </span>
<span>{cmd}</span>
</>
);
};

export default StdIn;
4 changes: 4 additions & 0 deletions src/components/StdIn/StdIn.modules.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.inCharacter {
color: rgb(6, 197, 6);
/* text-shadow: 0px 0px 5px; */
}
3 changes: 3 additions & 0 deletions src/components/StdIn/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import StdIn from "./StdIn";

export default StdIn;
9 changes: 9 additions & 0 deletions src/components/StdOut/StdOut.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import "./StdOut.modules.css";

const StdOut = (props) => {
const { children } = props;

Check failure on line 4 in src/components/StdOut/StdOut.jsx

View workflow job for this annotation

GitHub Actions / Lint

'children' is missing in props validation

return <div className="stdOut">{children}</div>;
};

export default StdOut;
6 changes: 6 additions & 0 deletions src/components/StdOut/StdOut.modules.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.stdOut {
/* text-shadow: 0px 0px 5px; */
margin-top: 5px;
margin-bottom: 15px;
margin-left: 15px;
}
3 changes: 3 additions & 0 deletions src/components/StdOut/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import StdOut from "./StdOut";

export default StdOut;
Loading

0 comments on commit 47e4b1d

Please sign in to comment.