Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo1 #3

Open
wants to merge 16 commits into
base: final
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SAM Overview

## Offchain

### sam-cli Tool
- **Vulnerability Detection:** Scans Lua code to identify vulnerabilities.
- **Detailed Reports:** Generates comprehensive reports outlining identified issues.
- **Fixed Rules and Patterns:** Applies predefined rules and patterns to enhance code security and quality.

## Onchain

### CRON Subscription
- **Automated Reports:**
- **Scheduled Analysis:** Regularly triggers detailed analysis of your code.
- **Comprehensive Reports:** Highlights vulnerabilities, code quality issues, and performance concerns.
- **Automated Delivery:** Reports are automatically sent to designated recipients, ensuring continuous monitoring.
- **Proactive Security:**
- **Continuous Monitoring:** Analyzes code on an ongoing basis.
- **Timely Alerts:** Provides immediate notifications of potential security issues.
- **Robust Security Posture:** Helps maintain a strong security stance by staying ahead of threats.

3 changes: 2 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "1.0.0",
"main": "servers.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"start":"npx nodemon server.js"
},
"keywords": [],
"type": "module",
Expand Down
Binary file added wallet-arweave/dist/Designer.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions wallet-arweave/dist/assets/index-D0shtLsX.css

Large diffs are not rendered by default.

153 changes: 153 additions & 0 deletions wallet-arweave/dist/assets/index-D3XvmE6C.js

Large diffs are not rendered by default.

Binary file added wallet-arweave/dist/images/code.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wallet-arweave/dist/images/image1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wallet-arweave/dist/images/image2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wallet-arweave/dist/images/image3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wallet-arweave/dist/images/image4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wallet-arweave/dist/images/npm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wallet-arweave/dist/images/pypi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wallet-arweave/dist/images/report.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions wallet-arweave/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SAM</title>
<link rel="icon" type="image/png" href="/logo.png">

<script type="module" crossorigin src="/assets/index-D3XvmE6C.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-D0shtLsX.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
Expand Down
Binary file added wallet-arweave/dist/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions wallet-arweave/dist/spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions wallet-arweave/dist/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 4 additions & 7 deletions wallet-arweave/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wallet-arweave/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"axios": "^1.7.2",
"chart.js": "^4.4.3",
"clsx": "^2.1.1",
"framer-motion": "^11.2.14",
"framer-motion": "^11.3.19",
"react": "^18.3.1",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.3.1",
Expand Down
Binary file added wallet-arweave/public/images/code.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wallet-arweave/public/images/npm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wallet-arweave/public/images/pypi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wallet-arweave/public/images/report.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions wallet-arweave/public/spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions wallet-arweave/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Monitor from "./pages/Monitor";
import MonitorDetail from "./pages/MonitorDetail";
// import Navbar from "./components/Navbar";
import Analyzer from "./pages/Analyzer";
import Offchain from "./pages/Offchain";

const App = () => {
return (
Expand All @@ -17,6 +18,7 @@ const App = () => {
<Route path="/monitor" element={<Monitor />} />
<Route path="/monitor/:id" element={<MonitorDetail />} />
<Route path="/analyze/:id" element={<Analyzer />} />
<Route path="/offchain" element={<Offchain />} />


</Routes>
Expand Down
95 changes: 53 additions & 42 deletions wallet-arweave/src/components/AnalyzerForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ export function AnalyzerForm() {
const [message, setMessage] = useState('');
const [email, setEmail] = useState('');
const [responseGot, setResponseGot] = useState(false);
const [messagerep, setMessagerep] = useState('');
const [loading, setLoading] = useState(false); // Loading state

const[messagerep,setMessagerep]=useState('')
const handleSubmit = async (e) => {
e.preventDefault();
const interval = `${minute} ${hour} ${dayOfMonth} ${month} ${dayOfWeek}`;
setLoading(true); // Start loading
try {
const response = await axios.post('http://localhost:3000/setupCRON', {
entity,
Expand All @@ -35,40 +37,44 @@ export function AnalyzerForm() {
console.error('Error setting up CRON job:', error);
setMessage('Error setting up CRON job');
}
setLoading(false); // End loading
};
const handlecronmail=async()=>{
const response=await axios.get(`http://localhost:3000/getreport?processId=${entity}&delayTime=*%20*%20*%20*%20*&email=${email}`)
console.log(response.data)
setMessagerep(response.data)

}
const handlecronmail = async () => {
setLoading(true); // Start loading
try {
const response = await axios.get(`http://localhost:3000/getreport?processId=${entity}&delayTime=*%20*%20*%20*%20*&email=${email}`);
console.log(response.data);
setMessagerep(response.data);
} catch (error) {
console.error('Error fetching CRON report:', error);
setMessagerep('Error fetching CRON report');
}
setLoading(false); // End loading
};

return (
<div className="p-4 w-1/2 mx-auto">
<h1 className="text-xl mb-4">Setup CRON Job</h1>
<form onSubmit={handleSubmit} className="space-y-4">
<div className="p-4 md:p-6 max-w-3xl mx-auto bg-gray-800 text-white font-mono rounded-lg shadow-lg">
<h1 className="text-2xl md:text-4xl font-semibold text-center mb-6">Setup CRON Job</h1>
<form onSubmit={handleSubmit} className="space-y-4 md:space-y-6">
<div>
<label htmlFor="entity" className="block text-sm font-medium text-gray-700">
Entity (Process ID)
</label>
<label htmlFor="entity" className="block text-sm md:text-lg font-medium">Entity (Process ID)</label>
<input
id="entity"
type="text"
value={entity}
onChange={(e) => setEntity(e.target.value)}
className="mt-1 p-2 block w-full border border-gray-300 rounded-md"
className="mt-1 p-2 md:p-3 block w-full border border-gray-600 rounded-lg bg-gray-900 placeholder-gray-500 focus:ring-blue-400 focus:border-blue-400"
required
/>
</div>
<div>
<label htmlFor="minute" className="block text-sm font-medium text-gray-700">
Minute
</label>
<label htmlFor="minute" className="block text-sm md:text-lg font-medium">Minute</label>
<select
id="minute"
value={minute}
onChange={(e) => setMinute(e.target.value)}
className="mt-1 p-2 block w-full border border-gray-300 rounded-md"
className="mt-1 p-2 md:p-3 block w-full border border-gray-600 rounded-lg bg-gray-900 text-white placeholder-gray-500 focus:ring-blue-400 focus:border-blue-400"
>
<option value="*">*</option>
{minutes.map((min) => (
Expand All @@ -77,14 +83,12 @@ export function AnalyzerForm() {
</select>
</div>
<div>
<label htmlFor="hour" className="block text-sm font-medium text-gray-700">
Hour
</label>
<label htmlFor="hour" className="block text-sm md:text-lg font-medium">Hour</label>
<select
id="hour"
value={hour}
onChange={(e) => setHour(e.target.value)}
className="mt-1 p-2 block w-full border border-gray-300 rounded-md"
className="mt-1 p-2 md:p-3 block w-full border border-gray-600 rounded-lg bg-gray-900 text-white placeholder-gray-500 focus:ring-blue-400 focus:border-blue-400"
>
<option value="*">*</option>
{hours.map((hr) => (
Expand All @@ -93,14 +97,12 @@ export function AnalyzerForm() {
</select>
</div>
<div>
<label htmlFor="dayOfMonth" className="block text-sm font-medium text-gray-700">
Day of Month
</label>
<label htmlFor="dayOfMonth" className="block text-sm md:text-lg font-medium">Day of Month</label>
<select
id="dayOfMonth"
value={dayOfMonth}
onChange={(e) => setDayOfMonth(e.target.value)}
className="mt-1 p-2 block w-full border border-gray-300 rounded-md"
className="mt-1 p-2 md:p-3 block w-full border border-gray-600 rounded-lg bg-gray-900 text-white placeholder-gray-500 focus:ring-blue-400 focus:border-blue-400"
>
<option value="*">*</option>
{daysOfMonth.map((dom) => (
Expand All @@ -109,14 +111,12 @@ export function AnalyzerForm() {
</select>
</div>
<div>
<label htmlFor="month" className="block text-sm font-medium text-gray-700">
Month
</label>
<label htmlFor="month" className="block text-sm md:text-lg font-medium">Month</label>
<select
id="month"
value={month}
onChange={(e) => setMonth(e.target.value)}
className="mt-1 p-2 block w-full border border-gray-300 rounded-md"
className="mt-1 p-2 md:p-3 block w-full border border-gray-600 rounded-lg bg-gray-900 text-white placeholder-gray-500 focus:ring-blue-400 focus:border-blue-400"
>
<option value="*">*</option>
{months.map((mon) => (
Expand All @@ -125,14 +125,12 @@ export function AnalyzerForm() {
</select>
</div>
<div>
<label htmlFor="dayOfWeek" className="block text-sm font-medium text-gray-700">
Day of Week
</label>
<label htmlFor="dayOfWeek" className="block text-sm md:text-lg font-medium">Day of Week</label>
<select
id="dayOfWeek"
value={dayOfWeek}
onChange={(e) => setDayOfWeek(e.target.value)}
className="mt-1 p-2 block w-full border border-gray-300 rounded-md"
className="mt-1 p-2 md:p-3 block w-full border border-gray-600 rounded-lg bg-gray-900 text-white placeholder-gray-500 focus:ring-blue-400 focus:border-blue-400"
>
<option value="*">*</option>
{daysOfWeek.map((dow) => (
Expand All @@ -142,33 +140,46 @@ export function AnalyzerForm() {
</div>
<button
type="submit"
className="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600"
className={`w-full py-2 md:py-3 px-4 text-white font-semibold rounded-lg border border-blue-500 bg-transparent hover:bg-blue-500 hover:text-white transition duration-200 ${loading ? 'bg-blue-300 cursor-wait' : ''}`}
disabled={loading}
>
Set Up CRON Job
{loading ? 'Setting Up...' : 'Set Up CRON Job'}
</button>
</form>
{message && (
<div className="mt-4 p-2 bg-gray-100 border text-black border-gray-300 rounded-md">
<div className="mt-4 md:mt-6 p-4 bg-gray-700 border border-gray-600 rounded-lg text-white">
{message}
</div>
)}
{responseGot && (
<div className='flex flex-col gap-3 jusify-center items-center'>
<div className='mt-4 md:mt-6'>
<label htmlFor="email" className="block text-sm md:text-lg font-medium">Email for CRON Reports</label>
<input
id="email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
className="mt-1 p-2 block w-full border border-gray-300 rounded-md"
className="mt-1 p-2 md:p-3 block w-full border border-gray-600 rounded-lg bg-gray-900 placeholder-gray-500 text-white focus:ring-blue-400 focus:border-blue-400"
placeholder="Enter your email"
required
/>
<button onClick={handlecronmail} className='btn btn-outline w-1/3 '>
Get Cron Reports
<button
onClick={handlecronmail}
className={`w-full mt-4 py-2 md:py-3 px-4 text-white font-semibold rounded-lg border border-blue-500 bg-transparent hover:bg-blue-500 hover:text-white transition duration-200 ${loading ? 'bg-blue-300 cursor-wait' : ''}`}
disabled={loading}
>
{loading ? 'Fetching...' : 'Get CRON Reports'}
</button>
{messagerep }
{loading && (
<div className="flex justify-center items-center mt-4">
<svg className="animate-spin h-8 w-8 md:h-12 md:w-12 text-blue-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor">
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8l4 4-4 4v-8a8 8 0 00-8-8z"></path>
</svg>
</div>
)}
{messagerep && <div className="mt-4 p-4 bg-gray-700 border border-gray-600 rounded-lg text-white">{messagerep}</div>}
</div>

)}
</div>
);
Expand Down
16 changes: 8 additions & 8 deletions wallet-arweave/src/components/Lamp.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use client";
import { motion } from "framer-motion";
import { LampContainer } from "./ui/lamp";
import { useNavigate } from "react-router-dom";

export function LampDemo() {
const navigate = useNavigate();
const handleClick = () => {
navigate('/monitor');
}

const handleClick = (route) => {
navigate(route);
};

return (
<LampContainer>
Expand All @@ -19,12 +19,12 @@ export function LampDemo() {
duration: 0.8,
ease: "easeInOut",
}}
className="mt-8 bg-gradient-to-br from-slate-300 to-slate-500 py-4 bg-clip-text text-center text-4xl font-medium tracking-tight text-transparent md:text-7xl"
className="mt-8 bg-gradient-to-br from-slate-300 to-slate-500 py-4 bg-clip-text text-center text-4xl font-mono tracking-tight text-transparent md:text-7xl"
>
You Write We Monitor
Code with Confidence
<div className="grid grid-cols-2 gap-4 mt-10 tracking-wide">
<button className="btn btn-outline text-xl">Off-Chain</button>
<button onClick={handleClick} className="btn btn-outline text-xl">On-Chain</button>
<button onClick={() => handleClick('/offchain')} className="btn btn-outline text-xl">Off-Chain</button>
<button onClick={() => handleClick('/monitor')} className="btn btn-outline text-xl">On-Chain</button>
</div>
</motion.h1>
</LampContainer>
Expand Down
2 changes: 1 addition & 1 deletion wallet-arweave/src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const Navbar = () => {
)}
</div>
<div className="flex-1 text-left">
<a href="/" className="btn btn-ghost text-2xl font-extrabold" onClick={handleHomeClick}>SAM</a>
<a href="/" className="btn btn-ghost text-2xl font-extrabold" onClick={handleHomeClick}>SAM-SUPPORT</a>
</div>
<div className="flex items-center ml-auto space-x-4">
<Wallet />
Expand Down
Loading