- | Status |
+ Status |
{typeof content.result!.status === 'string' ? (
content.result!.status
) : (
{content.result!.status.map((row: string, idx: number) => (
- - {row}
+ - {row.substring(0, row.indexOf(' '))}
))}
)}
diff --git a/src/enums/DnsType.enum.ts b/src/enums/DnsType.enum.ts
index 1416d09..4ebbd7e 100644
--- a/src/enums/DnsType.enum.ts
+++ b/src/enums/DnsType.enum.ts
@@ -1,7 +1,7 @@
export enum DnsType {
- A = 'a',
- AAAA = 'aaaa',
- CNAME = 'cname',
- TXT = 'txt',
- MX = 'mx',
+ A = 'A',
+ AAAA = 'AAAA',
+ CNAME = 'CNAME',
+ TXT = 'TXT',
+ MX = 'MX',
}
diff --git a/src/helpers/cn.helper.ts b/src/helpers/cn.helper.ts
new file mode 100644
index 0000000..e0273fc
--- /dev/null
+++ b/src/helpers/cn.helper.ts
@@ -0,0 +1,4 @@
+import { twMerge } from 'tailwind-merge';
+import { clsx, ClassValue } from 'clsx';
+
+export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));
diff --git a/src/hoc/H1.tsx b/src/hoc/H1.tsx
new file mode 100644
index 0000000..b37c0ac
--- /dev/null
+++ b/src/hoc/H1.tsx
@@ -0,0 +1,18 @@
+import React, { ReactNode } from 'react';
+import { cn } from '../helpers/cn.helper';
+
+export const H1: React.FC<{ children: ReactNode; className?: string }> = ({
+ className,
+ children,
+}) => {
+ return (
+
+ {children}
+
+ );
+};
diff --git a/src/services/http/worker.get.endpoints.http b/src/services/http/worker.get.endpoints.http
index dfc8929..7d7dfc3 100644
--- a/src/services/http/worker.get.endpoints.http
+++ b/src/services/http/worker.get.endpoints.http
@@ -1,5 +1,5 @@
# @import ./variables.http
-GET {{ WORKER_API_URL }}/whois?domain={{ ACTIVE_DOMAIN }}
+GET {{ WORKER_API_URL }}/dns?domain={{ ACTIVE_DOMAIN }}
// Sending a valid request with an active domain
###
@@ -18,11 +18,26 @@ GET {{ WORKER_API_URL }}/whois?domain=abv.bg
// Sending a request with an domain name from a reseller
###
-GET http://localhost:8787/dns?domain=nikola-nenovski.info
+GET http://localhost:8787/wp-check?domain=mrtnbdrv.com
###
GET http://localhost:8787/whois?domain=nikola-nenovski.info
###
+GET http://localhost:8787/cdn-check?domain=cexposurefilms.com
-GET https://api.github.com/repos/Nickslabcode/domain-info-lookup/releases
\ No newline at end of file
+###
+
+GET https://api.github.com/repos/Nickslabcode/domain-info-lookup/releases
+
+###
+# @import ./variables.http
+GET {{ WORKER_API_URL }}/wp-check?domain=mrtnbdrv.com
+
+###
+# @import ./variables.http
+GET {{ WORKER_API_URL }}/wp-check?domain=nikola-nenovski.info
+
+###
+
+GET https://o2h83alxd2.execute-api.eu-central-1.amazonaws.com/api/v1/wp-check?domain=cexposurefilms.com
\ No newline at end of file
diff --git a/src/services/wpCheck.service.ts b/src/services/wpCheck.service.ts
new file mode 100644
index 0000000..3f63004
--- /dev/null
+++ b/src/services/wpCheck.service.ts
@@ -0,0 +1,18 @@
+import axios from 'axios';
+
+export const isWordpressInstalled = async (domain: string) => {
+ try {
+ const response = await axios.get(
+ `https://domainlookup.nicknenovski.workers.dev/wp-check?domain=${domain}`,
+ {
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ }
+ );
+
+ return response.data;
+ } catch (error) {
+ console.error(error);
+ }
+};
diff --git a/src/views/Home.tsx b/src/views/Home.tsx
index 3d10ec0..0dc2777 100644
--- a/src/views/Home.tsx
+++ b/src/views/Home.tsx
@@ -2,8 +2,16 @@ import ViewContainer from '../hoc/ViewContainer';
import Footer from '../components/Footer';
import SearchForm from '../components/SearchForm';
import Logo from '../components/Logo';
+import { useSearchParams } from 'react-router-dom';
+import { useEffect } from 'react';
const Home = () => {
+ const [_searchParams, setSearchParams] = useSearchParams();
+
+ useEffect(() => {
+ setSearchParams({});
+ }, [setSearchParams]);
+
return (
<>
diff --git a/src/views/Results.tsx b/src/views/Results.tsx
index 845f753..b0cf656 100644
--- a/src/views/Results.tsx
+++ b/src/views/Results.tsx
@@ -1,7 +1,8 @@
+/* eslint-disable @typescript-eslint/no-explicit-any */
import Navbar from '../components/Navbar';
import ViewContainer from '../hoc/ViewContainer';
import Footer from '../components/Footer';
-import { useEffect, useState } from 'react';
+import { useEffect, useMemo, useState } from 'react';
import { useSearchParams } from 'react-router-dom';
import { getDomainSslInfo } from '../services/ssl.service';
import { getDomainInfo } from '../services/whois.service';
@@ -13,16 +14,36 @@ import { DnsRecordAnswer } from '../types/DnsRecordAnswer';
import { DnsType } from '../enums/DnsType.enum';
import SslTable from '../components/SslTable';
import WhoisTable from '../components/WhoisTable';
+import { H1 } from '../hoc/H1';
+import Markers from '../components/Markers';
+import { isWordpressInstalled } from '../services/wpCheck.service';
+
+interface WhoIsData {
+ result?: Record;
+ [key: string]: any;
+}
const Results = () => {
const [searchParams] = useSearchParams();
- const [sslData, setSslData] = useState>({});
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const [whoIsData, setWhoIsData] = useState | string>();
+
+ const [sslData, setSslData] = useState>();
+
+ const [whoIsData, setWhoIsData] = useState();
const [dnsData, setDnsData] =
useState>();
+ const [hasWp, setHasWp] = useState(false);
+ const [hasWwwRecord, setHasWwwRecord] = useState(false);
const [progress, setProgress] = useState(0);
const [isLoading, setIsLoading] = useState(false);
+ const wwwSsl = useMemo(() => {
+ const domain = searchParams.get('domain');
+
+ return (
+ sslData?.dns_names?.filter(
+ (dns_name: string) => dns_name === `www.${domain}` || `*.${domain}`
+ ).length > 0
+ );
+ }, [sslData, searchParams]);
useEffect(() => {
setProgress(0);
@@ -46,6 +67,15 @@ const Results = () => {
setDnsData(data);
setProgress(prevValue => prevValue + 1);
}),
+ getDnsRecordInfo(`www.${domain}`).then(data => {
+ const answer = Array.isArray(data.A) || Array.isArray(data.CNAME);
+ setHasWwwRecord(answer);
+ setProgress(prevValue => prevValue + 1);
+ }),
+ isWordpressInstalled(domain).then(data => {
+ setHasWp(data.isInstalled);
+ setProgress(prevValue => prevValue + 1);
+ }),
];
await Promise.all(tasks);
@@ -67,10 +97,18 @@ const Results = () => {
) : (
<>
+
+ Looking up {searchParams.get('domain')}
+
+
-
- DNS Info
-
+ DNS Info
{dnsData &&
Object.entries(dnsData).map(([type, answer]) => {
@@ -82,17 +120,13 @@ const Results = () => {
})}
-
-
-
- WHOIS Info
-
+
+
+ WHOIS Info
{whoIsData && }
-
- SSL Info
-
+ SSL Info
{sslData && }
diff --git a/tailwind.config.js b/tailwind.config.js
index c1f8e8a..24ce6ef 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -129,11 +129,11 @@ export default {
success: '#859900',
'success-content': '#fdf6e3',
- warning: '#dc322f',
+ warning: '#e2b714',
'warning-content': '#fdf6e3',
- error: '#d33682',
- 'error-content': '#9b225c',
+ error: '#da3333',
+ 'error-content': '#fedad5',
},
},
],
diff --git a/workers/domainlookup/src/handlers/cdnCheckHandler.ts b/workers/domainlookup/src/handlers/cdnCheckHandler.ts
new file mode 100644
index 0000000..13b5c5d
--- /dev/null
+++ b/workers/domainlookup/src/handlers/cdnCheckHandler.ts
@@ -0,0 +1,41 @@
+export const cdnCheck = async (request: Request) => {
+ const { searchParams } = new URL(request.url);
+ const domain = searchParams.get('domain');
+
+ if (!domain) {
+ return new Response('Domain query parameter is required', { status: 400 });
+ }
+
+ const headers = {
+ 'Access-Control-Allow-Origin': '*',
+ 'Access-Control-Allow-Methods': 'GET',
+ 'Access-Control-Allow-Headers': 'Content-Type',
+ };
+
+ try {
+ const response = await fetch(`https://${domain}`, {
+ headers: {
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36',
+ Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
+ 'Accept-Language': 'en-US,en;q=0.9',
+ Referer: `https://${domain}/`,
+ Connection: 'keep-alive',
+ },
+ });
+
+ if (response.ok) {
+ const responseHeaders = response.headers.get('x-sg-cdn');
+ console.log(responseHeaders);
+
+ return new Response(JSON.stringify({ cdn: responseHeaders }), {
+ status: 200,
+ headers: { ...headers, 'Content-Type': 'application/json' },
+ });
+ } else {
+ return new Response('There was a problem fetching the data. Please try again later.', { status: response.status });
+ }
+ } catch (error) {
+ console.error(' There was an error fetching the data: ', error);
+ return new Response('Internal server error. Please try again later.', { status: 500 });
+ }
+};
diff --git a/workers/domainlookup/src/handlers/wpCheckHandler.ts b/workers/domainlookup/src/handlers/wpCheckHandler.ts
new file mode 100644
index 0000000..ce27a46
--- /dev/null
+++ b/workers/domainlookup/src/handlers/wpCheckHandler.ts
@@ -0,0 +1,41 @@
+export const wpCheck = async (request: Request): Promise => {
+ const { searchParams } = new URL(request.url);
+ const domain = searchParams.get('domain');
+
+ if (!domain) {
+ return new Response('Domain query parameter is required', { status: 400 });
+ }
+
+ const headers = {
+ 'Access-Control-Allow-Origin': '*',
+ 'Access-Control-Allow-Methods': 'GET',
+ 'Access-Control-Allow-Headers': 'Content-Type',
+ };
+
+ try {
+ const response = await fetch(`https://${domain}/readme.html`, {
+ headers: {
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36',
+ Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
+ 'Accept-Language': 'en-US,en;q=0.9',
+ Referer: `https://${domain}/`,
+ Connection: 'keep-alive',
+ },
+ });
+
+ if (response.ok) {
+ const data = await response.text();
+ const answer = data.includes('wordpress');
+
+ return new Response(JSON.stringify({ isInstalled: answer }), {
+ status: 200,
+ headers: { ...headers, 'Content-Type': 'application/json' },
+ });
+ } else {
+ return new Response('There was a problem fetching the data. Please try again later.', { status: response.status });
+ }
+ } catch (error) {
+ console.error('There was an error fetching the data: ', error);
+ return new Response('Internal server error. Please try again later.', { status: 500 });
+ }
+};
diff --git a/workers/domainlookup/src/index.ts b/workers/domainlookup/src/index.ts
index 1825054..20f19ec 100644
--- a/workers/domainlookup/src/index.ts
+++ b/workers/domainlookup/src/index.ts
@@ -1,6 +1,8 @@
+import { cdnCheck } from './handlers/cdnCheckHandler';
import { fetchDnsData } from './handlers/dnsHandler';
import { fetchSslData } from './handlers/sslHandler';
import { fetchWhoisData } from './handlers/whoisHandler';
+import { wpCheck } from './handlers/wpCheckHandler';
export default {
async fetch(request: Request, env: Env, _ctx: ExecutionContext): Promise {
@@ -8,7 +10,7 @@ export default {
const path = url.pathname;
const method = request.method;
- if (method !== 'GET') {
+ if (method !== 'GET' && method !== 'HEAD') {
return new Response('Method not allowed.', { status: 405 });
}
@@ -19,6 +21,10 @@ export default {
return fetchSslData(request, env);
case '/dns':
return fetchDnsData(request);
+ case '/wp-check':
+ return wpCheck(request);
+ case '/cdn-check':
+ return cdnCheck(request);
default:
return new Response('Not Found', { status: 404 });
}
|